-
Notifications
You must be signed in to change notification settings - Fork 180
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
HTTPS request gets blocked while using proxy #562
Comments
I'm met with the same issue on the same setup as @vdayanand. I also managed to isolate the issue to
|
I noticed that there is a change #529 that landed in v0.8.14 which makes some changes to error-handling in the ConnectionPoolLayer, and it looks a bit weird for HTTPS requests. Previously: HTTP.jl/src/ConnectionRequest.jl Lines 84 to 100 in b9076be
Current: HTTP.jl/src/ConnectionRequest.jl Lines 84 to 94 in abc5d3d
It seems that previously the |
Oh my... it worked! 🎉 I changed line 84-89 to the following:
I would believe this part might benefit from some refactoring to bring out the intention better. For line 84-93, if what we want is for proxied HTTPS connections to always close, then we might want to consider grouping by existence of HTTPS proxy:
If actually
|
On further look, it might be that the additional code was to figure out some weird behaviour of why
It has a clearer intention, and spur us to fix |
Sorry I was being careless, I should have read the history first to have a better understanding of the rationale myself. So I've read that:
This is from #529:
Let's see... The problem is valid. Double closing in both error and final is a code smell. However, I would disagree with the solution. As I mentioned above, (and also discussed in #529 (comment)), I would thus recommend us to go with not closing in
I might have under-considered the problem, so together with @vdayanand, I would like to invite the original contributors for more discussion on how to resolve this bug please. @samoconnor @Keno |
Fixes #562. Despite lots of back and forth on this issue, it turns out there's a simpler diagnosis & fix that worrying too much about when sockets will throw when `close`ing (which we should certainly get all cleaned up one day). The _real_ issue here is in `ConnectionPool.sslupgrade` which was effectively swapping our `Connection` that we formally "acquired" from the connection pool with a new one that had a https-ssl-upgraded `SSLContext` to do the request tunneling. The issue with just swapping the `Connection` is that the original connection was never properly "released" to the connection pool, so connections were acquired, but never released, and eventually we hit the `connection_limit`. The proposed solution here (which works locally to avoid getting hung up on the connection pool clogging), is to introduce a new `kill!(c::Connection)` method that "releases" a connection without returning it to the connection pool. So we signal to the pool that a connection has finished, but it's not put back in the queue to be re-used, which is what we want. I should note that this does mean that proxied https requests then don't really respect the `connection_limit`, but also note that it never has due to this "swapping".
This happens only for HTTPS connections.
Julia 1.4.1
HTTP.jl 0.8.16
MbedTLS.jl 1.0.2
Proxy: https://hub.docker.com/r/datadog/squid/
The text was updated successfully, but these errors were encountered: