net: stop monitoring select exceptions outside Windows #36716

pull Sjors wants to merge 2 commits into bitcoin:master from Sjors:2026/10/windows-select-exceptions changing 3 files +23 −0
  1. Sjors commented at 4:13 AM on October 31, 2026: member

    Alternative approach to #36688, citing the relevant parts of its description:

    There is currently nothing preventing us to receive TCP urgent data, which would never be returned by recv(). Linux's poll() is indifferent to this, but the select() socket monitoring may keep reporting it as pending on some platforms.

    This would not prevent progress nor lead to a crash anymore after #36665, but it's still undesirable.

    Fix this by ignoring the exceptionSet. Except on Windows, where we instead disconnect if its used.

    We could instead have set SO_OOBINLINE on our sockets, so recv() returns any urgent data sent to us (and likely leads us to disconnect the peer). But this goes against the spirit of RFC 6093, as documented in the second commit.

  2. net: stop monitoring select exceptions outside Windows
    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.
    
    Co-authored-by: Antoine Poinsot <mail@antoinep.com>
    1fde57f1de
  3. doc: explain why P2P does not set SO_OOBINLINE 8754e5c1c4
  4. DrahtBot added the label P2P on Oct 31, 2026
  5. DrahtBot commented at 4:13 AM on October 31, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  6. pinheadmz commented at 11:38 AM on October 31, 2026: member

    Mine as well apply the same logic to HTTP, probably right here:

    https://github.com/bitcoin/bitcoin/blob/5669fda5ed85ac739c1678c03bd7c25193d099c6/src/httpserver.cpp#L916-L918

    I wrote functional test for the first PR, could be adapted to ensuring HTTP disconnects on urgent data:

    https://gist.github.com/pinheadmz/f5bb77865f870865e44c54d5751b569a


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-10-31 21:51 UTC

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