Apply the request deadline to TCP frame reads - #137
Open
hsbt wants to merge 1 commit into
Open
Conversation
Requester#request computes a monotonic time limit but only the socket readability wait honoured it, so a peer that sends an incomplete length prefix or message body and keeps the connection open blocked past the configured timeouts. The TCP reader now takes that time limit and raises ResolvTimeout, matching what the readability wait already does. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolv::DNS::Requester#requestcomputes a monotonic time limit from the configured timeouts, but only the socket readability wait honours it. Once the socket becomes readable,Requester::TCP#recv_replycalls blockingreadtwice, so a peer that sends an incomplete length prefix or message body and keeps the connection open blocks the call until the peer closes the connection.This passes the time limit down to
recv_replyand makes the TCP reader complete each frame within it, raisingResolvTimeouton expiry just like the readability wait does. The UDP requesters are unchanged since a readable socket yields a complete datagram in one call. The parameter defaults tonil, which keeps the previous blocking behaviour and existing subclass signatures working. TheEOFErrorbehaviour for early connection close from #105 is preserved.