Repository navigation
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, 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. |
0ac83b6 to
ccd8095
Compare
4713c03 to
08172c5
Compare
|
#36716 landed, rebased. I made the |
08172c5 to
020ff3b
Compare
|
Trivial rebase after #36916. |
Name the wait mechanism rather than the platform in the ErrorEvent documentation. No behavior change. Co-authored-by: Matthew Zipkin <[email protected]>
Move it out of p2p_ping_ibd.py and return the stalled byte count.
Check that urgent indications do not prevent ordinary P2P input from being processed or count as received message bytes. Co-authored-by: Matthew Zipkin <[email protected]>
Reset a slow reader with block output stalled and more input queued behind receive backpressure. Add pack_linger() and the linux_host and windows_target checks to the framework. Give peer_disconnect() a reset option and have mine_large_block() return the block hash and size.
On Linux a socket error or hangup is reported whichever events were requested. Disconnect directly when no read was requested, skipping the send attempt that would otherwise fail and disconnect the peer. This also changes the debug log message. Co-authored-by: Cory Fields <[email protected]>
Check that an urgent byte does not disturb an ordinary request, and reset a client while the server has unsent responses. Co-authored-by: Matthew Zipkin <[email protected]>
When a socket error or hangup is reported and no read was requested, disconnect before sending instead of reading. This also changes the debug log message. Co-authored-by: Matthew Zipkin <[email protected]>
020ff3b to
4a9e07c
Compare
| # Send more pings while receiving is paused. Give them time to reach the | ||
| # node's kernel, as the reset discards anything not yet delivered. | ||
| peer.send_raw_message(pings) | ||
| time.sleep(1 * self.options.timeout_factor) |
There was a problem hiding this comment.
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?
| conn.conn.sock.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, pack_linger(enabled=True, timeout=0)) | ||
| with self.node.assert_debug_log(expected_msgs, timeout=10): |
There was a problem hiding this comment.
The suggestion below fails on Linux without client->Disconnect(), and passes on Linux and macOS with it.
| conn.conn.sock.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, pack_linger(enabled=True, timeout=0)) | |
| with self.node.assert_debug_log(expected_msgs, timeout=10): | |
| port = conn.conn.sock.getsockname()[1] | |
| expected_msgs.append(f"Disconnecting HTTP client 127.0.0.1:{port} (") | |
| conn.conn.sock.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, pack_linger(enabled=True, timeout=0)) | |
| with self.node.assert_debug_log(expected_msgs, timeout=10): |

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 #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 #36716,
p2p_socket_errors.pyadds coverage for existing behavior:Similarly
interface_http.pychecks that:The first two commits follow up on review comments in #36716: the
ErrorEventdocumentation now describes the behavior bypoll()andselect()rather than by platform, as suggested in #36716 (comment), and a comment is dropped from thewait_ignores_urgent_dataunit test, as suggested in #36716 (comment).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 expect