mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 15:14:39 +00:00
net, http: handle socket errors separately from reads #36963
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36963
Loading…
Reference in a new issue
No description provided.
Delete branch "2026/11/http-socket-errors"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
With
poll(), which we only use on Linux, a socket error or hangup is reported whether or not we asked for it. If that happens for a peer we did not request to read from, disconnect directly. This just adds clarity: previously we would attempt a send that would then fail. The only side-effect is a changed log message. Nothing changes on other platforms: since bitcoin/bitcoin#36716 they no longer report errors for established connections.The last commit does the same for HTTP, where on error it also no longer attempts a final read from a client whose reads are paused.
As a followup to bitcoin/bitcoin#36716,
p2p_socket_errors.pyadds coverage for existing behavior:Similarly
interface_http.pychecks that:The first two commits follow up on review comments in bitcoin/bitcoin#36716: the
ErrorEventdocumentation now describes the behavior bypoll()andselect()rather than by platform, as suggested in https://github.com/bitcoin/bitcoin/pull/36716#discussion_r4745459504, and a comment is dropped from thewait_ignores_urgent_dataunit test, as suggested in https://github.com/bitcoin/bitcoin/pull/36716#discussion_r4700726004.To support the new tests, the test framework gains:
wait_for_send_stall(), moved out ofp2p_ping_ibd.pyresetoption forpeer_disconnect(), which closes the connection with a TCP resetmine_large_block()returns the block hash and sizepack_linger(), andlinux_host/windows_targetto tell which log message to expectThe following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.Conflicts
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
Earlier concerns neither republished nor resolved: 1 suggestion. See the Run archive linked from the Review report for their assessments.
🟠 Minor · Ping-batch wait depends on
recv()boundariesAlthough no failing environment was identified, a short read of the ping batch can trigger backpressure early and make this functional test time out before the reset.
Location:
test/functional/p2p_socket_errors.py:105(head).🔵 Suggestion · HTTP reset test does not verify client removal
The HTTP reset check asserts no server-side outcome on
select()targets and only a pre-disconnection log onpoll()targets, so it can miss a client-removal regression.Location:
test/functional/interface_http.py:920(head).Reviewed:
4a9e07cd6129· Review report · Previous reportspermalink
🐙 This pull request conflicts with the target branch and needs rebase.
#36716 landed, rebased.
I made the
check_reset_while_sendingtest easier to understand.🐙 This pull request conflicts with the target branch and needs rebase.
Trivial rebase after #36916.
tACK
4a9e07cd61Tested on Linux and macOS.
The suggestion below fails on Linux without
client->Disconnect(), and passes on Linux and macOS with it.The test takes 42 to 44 s with CI's
--timeout-factor=40, against 2 to 3 s without the factor.Without the sleep, the last check still failed locally when I made the node read the pings. Wouldn't it be better for the sleep to be one second?