Test whether created sockets are select()able#6412
Conversation
There was a problem hiding this comment.
Suggest removing " (file descriptor limit exceeded?)" since this description is inaccurate and likely to confuse someone trying to debug it.
There was a problem hiding this comment.
"non-selectable socket created" is completely unhelpful for indicating the reason or helping debug it. So I prefer to explain it a bit at least. Do you have a better suggestion?
There was a problem hiding this comment.
I'd say the file descriptor limit exceeded is the part of the message that matters most.
There was a problem hiding this comment.
" (socket cannot be included in fdset)" perhaps? The actual fd limit very much has not been exceeded in most situations you'd get this error...
There was a problem hiding this comment.
Well OK @luke-jr is right in that this is not "the" file descriptor limit, just the select file descriptor limit. Let's just name the beast as it is:
Cannot create connection: non-selectable socket created (>=FD_SETSIZE)
|
select() is also used in netbase, seems it would make sense to check there. Also, if connect() were to return an EINVAL for any reason, that could trigger this in netbase. Have you considered just printing the fd value? For language I'd go simple "invalid file descriptor %ud from netbase on connect". |
|
utACK |
There was a problem hiding this comment.
Don' think it should double as "is this an error return value"
b40d7b6 to
a29e66c
Compare
|
Updated. The test is now done also in netbase (causing simple failure, as netbase does not usually print error messages), and when creating a listen socket. |
1cf0d45 to
68c0819
Compare
|
Needs backport to 0.11 and 0.10 (doesn't seem to involved, I'm willing to do that) |
|
See my branches nonselectsocket-0.11 and nonselectsocket-0.10. |
There was a problem hiding this comment.
strprintf doesn't work without arguments (and is redundant)
|
@laanwj Done. |
|
This brings up a warning, as SOCKET is defined as unsigned int: |
|
@sipa are you planning to fix the warning or should we not hold this up on that? |
d422f9b Test whether created sockets are select()able (Pieter Wuille)
SOCKET are defined as unsigned integers, thus always >=0.
SOCKET are defined as unsigned integers, thus always >=0. Rebased-From: 89289d8
SOCKET are defined as unsigned integers, thus always >=0. Rebased-From: 89289d8
ae52a7f Fix warning introduced by bitcoin#6412 (Wladimir J. van der Laan) 0739e6e Test whether created sockets are select()able (Pieter Wuille) 255eced Updated URL location of netinstall for Debian (฿tcDrak) 7e66e9c openssl: avoid config file load/race (Cory Fields) 3f55638 doc: update mailing list address (Wladimir J. van der Laan) be64204 Add option `-alerts` to opt out of alert system (Wladimir J. van der Laan) 0fd8464 Fix getbalance * (Tom Harding) 09334e0 configure: Detect (and reject) LibreSSL (Luke Dashjr) 181771b json: fail read_string if string contains trailing garbage (Wladimir J. van der Laan) ecc96f5 Remove P2SH coinbase flag, no longer interesting (Luke Dashjr) ebd7d8d Parameter interaction: disable upnp if -proxy set (Wladimir J. van der Laan) ae3d8f3 Fix two problems in CSubNet parsing (Wladimir J. van der Laan) e4a7d51 Simplify code for CSubnet (Wladimir J. van der Laan) Conflicts: README.md
Conflicts: src/net.cpp Github-Pull: bitcoin#6412 Rebased-From: d422f9b (cherry picked from commit 0739e6e)
This provides a belt-and-suspends check against file descriptor overflowing, to fix #6411.