Repository navigation
Conversation
The persistent socket was built with HTTP.persistent alone, so the timeout option only reached the non-persistent path. With persistent mode on by default, requests ran with no client-side timeout.
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.
The persistent socket is built with
HTTP.persistent(...)alone, so thetimeoutoption only reaches the non-persistent path inexecute_request. Sincepersistent: trueis the default, most clients make requests with no client-side timeout:A request on a half-open connection then waits on the OS TCP retry limit, and a server that accepts but never responds can block the caller indefinitely.
Change: build the socket with
HTTP.timeout(timeout).persistent(...). http.rb resets the global timeout counter after each response on a kept-alive connection, so long-lived clients are not cut off aftertimeoutseconds in total.The README options table describes
timeoutas applying to non-persistent requests only, while its examples passtimeout:withpersistent: true. I've updated the table to match; if the current behavior is intended, happy to close this.Tested:
applies the timeout to the persistent socketfails before the change (got: {}) and passes after. It makes no network call.rubocop lib spec: no offenses.timeout: 30: both succeeded over the same socket, andclosereturned:clean.This fix was also part of #22, which was closed by its author along with several unrelated changes. This PR only carries the timeout fix.