Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response to interrupted request returned for next one, after timeout interrupts reading the socket #157

Open
DanielHeath opened this issue Sep 21, 2023 · 2 comments

Comments

@DanielHeath
Copy link

In ruby-3.2.2/lib/ruby/3.2.0/net/http.rb line 1855, a request is written to the socket; on line 1862 the response is read from the socket.

However, if a Timeout::Error occurs before the response arrives, the response is not read from the socket.

If the client is re-used, this causes the next request to read the response from the interrupted request (since it's queued on the socket and nothing else has read it).

@DanielHeath
Copy link
Author

Added a test highlighting this bug to my fork

@DanielHeath
Copy link
Author

After more digging, I've found that timeout 0.4.0 fixes this issue.

ruby/timeout#30 indicates that you can't rely on catch, if Kernel.catch has been called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant