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

Requests sent twice #667

Closed
NikEyX opened this issue Jan 27, 2021 · 7 comments
Closed

Requests sent twice #667

NikEyX opened this issue Jan 27, 2021 · 7 comments
Labels
bug client About our HTTP client

Comments

@NikEyX
Copy link

NikEyX commented Jan 27, 2021

Julia 1.5.3
HTTP 0.9.1

In very rare circumstances the HTTP lib seems to send the same request TWICE using
r = HTTP.request("GET", url; verbose=0, connection_limit=500, pipeline_limit=0, readtimeout=60)

This happens maybe every 10,000 requests. Note that I am running this on spawned threads and that the double request is coming from the same thread.

I gonna try to create a reproduceable example but until then would anyone have an idea what the cause of that could be?

@quinnj
Copy link
Member

quinnj commented Jan 27, 2021

There are default retry options:

- `retries = 4`, number of times to retry.
. If a request fails for some retry-able reason, then the request will automatically be retried. You can prevent this by passing retry=false or retries=0.

@NikEyX
Copy link
Author

NikEyX commented Jan 27, 2021

Ok I will try that and reopen if the problem resurfaces. Thanks Jacob

@NikEyX NikEyX closed this as completed Jan 27, 2021
@NikEyX
Copy link
Author

NikEyX commented Jan 28, 2021

Hmm, I seem to be getting a bunch of these now:

IOError(Base.IOError("stream is closed or unusable", 0) 

I am not sure why it would show "stream is closed".

Currently I am using:

r = HTTP.request("GET", url; verbose=3, connection_limit=500, pipeline_limit=0, readtimeout=60 * 60, retry=false, redirect=false)

I wonder if this may be somehow related to the pipeline_limit=0?

So what's the right fix for this? And is there any particular reason that this seems to happen on the server side?

Note: I also updated to HTTP 0.9.2 because I've seen there were some commits on those lines, but that didn't seem to fix it.

@NikEyX NikEyX reopened this Jan 28, 2021
@NikEyX
Copy link
Author

NikEyX commented Jan 28, 2021

Ok, so this seems to happen notably when HTTP requests are done in quick succession, i.e.:

r = HTTP.request("GET", url; verbose=3, connection_limit=500, pipeline_limit=0, readtimeout=60 * 60, retry=false, redirect=false)
r = HTTP.request("GET", url; verbose=3, connection_limit=500, pipeline_limit=0, readtimeout=60 * 60, retry=false, redirect=false)
r = HTTP.request("GET", url; verbose=3, connection_limit=500, pipeline_limit=0, readtimeout=60 * 60, retry=false, redirect=false)

will ALWAYS result in the IOError(Base.IOError("stream is closed or unusable", 0) during request(...)) error.
However, if I add sleep(1) in between it will work without problem. So it seems almost like the HTTP lib is trying to reuse the connection despite the pipeline_limit=0 suggesting that it shouldn't do that?

@c42f
Copy link
Contributor

c42f commented Jul 20, 2021

I think pipeline_limit isn't respected, due to the race conditions described in #517 (comment)

@fonsp
Copy link
Member

fonsp commented Mar 16, 2022

Pipelines have been removed for clients, #783 , which might fix this issue. Could you try this again with:

julia> ]
pkg> add HTTP#master 

@fonsp fonsp added bug client About our HTTP client labels Mar 16, 2022
@quinnj
Copy link
Member

quinnj commented May 26, 2022

Any remaining issues here should be resolved in HTTP#master

@quinnj quinnj closed this as completed May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug client About our HTTP client
Projects
None yet
Development

No branches or pull requests

4 participants