bitcoind throw error `Cannot create connection` if there are more than 1024 cocurrent connections #18158

issue greensea opened this issue on February 16, 2020
  1. greensea commented at 10:02 AM on February 16, 2020: none

    Bitcoind throw an error:

    Cannot create connection: non-selectable socket created (fd >= FD_SETSIZE ?)
    

    Expected behavior

    Should not display this error.

    To reproduce Before start bitcoind, set fd limit to 10240

    ulimit -n 10240
    

    Then start bitcoind with -rpcworkqueue=10240 parameter. Start to send over 1024 requests to RPC on the same time.

    bitcoind version is 0.17.0, OS is Linux.

    Possiable Cause I have check the code, if a socket is !IsSelectableSocket(), bitcoind then print this error. Then I check IsSelectableSocket function in src/compat.h, I found IsSelectableSocket() may return ( fd < FD_SETSIZE) as return value if OS is not Linux. This is strange while I am using Linux. I think the __linux__ macro is not defined on compiling, but I cant verify that. The binary file from official site.

  2. greensea added the label Bug on Feb 16, 2020
  3. hebasto commented at 6:46 PM on February 16, 2020: member
  4. gmaxwell commented at 3:29 AM on February 17, 2020: contributor

    @hebasto Why do you think this is not a bug? Right below, IsSelectableSocket should be return true on linux, and the reporter says they are using the release binaries on linux. This sounds like it is not correctly using poll anymore, which would be pretty bad.

    bitcoind version is 0.17.0, OS is Linux.

    That is a fairly old version, I'm doubtful anyone is too interested in reports on versions that old, though the code looks the same in current versions... this behaviour could change due to build system differences.

    Several other parts of the codebase also use "__linux__".

  5. MarcoFalke added this to the milestone 0.20.0 on Feb 17, 2020
  6. MarcoFalke added the label P2P on Feb 17, 2020
  7. hebasto commented at 1:30 PM on February 17, 2020: member

    @greensea

    bitcoind version is 0.17.0, OS is Linux. The binary file from official site.

    Which of the following?

    bitcoin-0.17.0-aarch64-linux-gnu.tar.gz            03-Oct-2018 09:12            27078635
    bitcoin-0.17.0-arm-linux-gnueabihf.tar.gz          03-Oct-2018 09:12            24306360
    bitcoin-0.17.0-i686-pc-linux-gnu.tar.gz            03-Oct-2018 09:13            30680891
    bitcoin-0.17.0-x86_64-linux-gnu.tar.gz             03-Oct-2018 09:15            28262892
    
  8. greensea commented at 1:52 PM on February 17, 2020: none

    I am using this one: https://bitcoin.org/bin/bitcoin-core-0.17.0.1/bitcoin-0.17.0.1-x86_64-linux-gnu.tar.gz

    I just noticed 0.19 is released, I will upgrade my binary to 0.19 and check if this error still exists. I will report the result later.

  9. greensea commented at 2:45 AM on February 19, 2020: none

    After upgrade to 0.19.0.1, this error never occurs. Maybe there is a compile mistake in 0.17.0.1 binary? Anyway, version 0.19.0.1 works perfectly now.

  10. MarcoFalke removed this from the milestone 0.20.0 on Feb 19, 2020
  11. hebasto commented at 6:55 AM on February 19, 2020: member

    Is it worth adding to bitcoind and bitcoin-qt ability to provide a user with compiling flags info (or some important ones of them), e.g., to the debug.log file (smth like #17826) ?

  12. aureleoules commented at 12:15 AM on September 18, 2022: member

    I think this can be closed?

  13. MarcoFalke commented at 8:39 AM on September 18, 2022: member

    Yeah, looks like this was fixed in 0.19 onward, based on the last comment by the reporter?

  14. MarcoFalke closed this on Sep 18, 2022

  15. bitcoin locked this on Sep 18, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-02 12:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me