#36716 net: stop monitoring select exceptions outside Windows
| Reviewability | Reviews | Agreement | Size | ||||
|---|---|---|---|---|---|---|---|
| #36716 net: stop monitoring select exceptions outside Windows | Ready | 0 | Crickets | 23 | |||
|
|
|
|
| |||
Reviewability: ReadyStalePaused Agreement: StrongPositivePositive w/ caveatsNeutralMildDisputedBlockedCrickets Reviews: current code-review ACKs, then (+stale ACKs) and -NACKs; greener = more ACKs. Size: lines added or modified outside tests, then in tests; greener = smaller. | |||||||
Goal
Restricts socket exception monitoring in select() to Windows, and disconnects established peers on Windows if an exception condition occurs. It also adds documentation explaining why Bitcoin Core's P2P layer does not enable SO_OOBINLINE.
Problem: Incoming TCP urgent data sets the socket exception condition in select(). On POSIX systems where urgent data is not read, this can leave the exception pending and cause the network event loop to spin in a busy loop. Bitcoin Core does not use out-of-band data, but Windows still requires monitoring the exception set to detect failed non-blocking connect calls.
Evidence of importance:
- Commit 1fde57f1de states: 'Windows needs select's exception set to detect failed non-blocking connects. On other platforms, a TCP urgent pointer can leave the exception set pending even when no data is readable. Only monitor it on Windows, and disconnect established P2P peers if it is set.'
Risk of a mistake: medium (p2p). Altering select() socket event handling could inadvertently ignore connection failure errors on non-Windows platforms or disconnect valid peers on Windows.
Changed since the previous assessment: No functional changes to the patch; previous description had no patch diff attached.
Reviewability
Ready
Nothing known that would invalidate a review now.
Waiting on (from the thread read):
- reviewer: pinheadmz to review or respond to author's preference for an HTTP followup 2026-11-01
Agreement
Crickets
no substantive comment either way
Thread notes: Sjors replied to pinheadmz's suggestion regarding HTTP server exception handling, preferring a followup.
Objections, suggestions, and questions:
| Reviewer | Type | Harm, request, or question | Status | Must be | Author replied | Quote |
|---|---|---|---|---|---|---|
| pinheadmz (member) | suggestion, scope | Apply the same exception-handling logic and urgent-data disconnect test to HTTP in httpserver.cpp | answered · author prefers handling HTTP separately in a followup but is open to doing it here | answered | yes | 2026-10-31: 'Mine as well apply the same logic to HTTP, probably right here' Status from: 2026-11-01: Sjors: 'My preference is to fix HTTP separately as a followup, but I'm open to doing it here.' |
Participants:
- pinheadmz (member, neutral, 1 statements 2026-10-31 to 2026-10-31): suggested applying the same logic to the HTTP server
Files
0 lines under test/bench/ci.
- src/net.cpp +12/-0
- src/netbase.cpp +8/-0
- src/util/sock.cpp +3/-0
Card
The short text the ranking pass compares across PRs.
Stops monitoring socket exception sets in select() on non-Windows platforms, and disconnects established P2P peers on Windows if an exception triggers. On POSIX systems, TCP urgent data or out-of-band pointers can leave socket exceptions pending without readable data, causing network event loops to busy-spin. This serves as an alternative to PR 36688, avoiding SO_OOBINLINE per RFC 6093 recommendations.
Data
thread read through 2026-11-01 (2 statements), head 8754e5c1c4
labels: P2P
Categories
P2P
P2 · DoS protection
Prevents a potential busy loop in the P2P network event loop caused by incoming TCP urgent data. As noted in commit 1fde57f1de, on POSIX systems 'a TCP urgent pointer can leave the exception set pending even when no data is readable', which causes select() to spin continuously.
Membership: Matches the P2P label and modifies connection management and socket polling in src/net.cpp and src/netbase.cpp.
Factors: security/stability 2, bug 2, performance 1, user value 0, leverage 0