-
Notifications
You must be signed in to change notification settings - Fork 240
Resource leak with aleph.http/create-connection and unreachable hosts #152
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
Comments
Yes, |
I hadn't, but trying them now with a timeout value of 1 on all 3 of them I am still seeing requests continue to go out via |
Okay, I'll investigate further, thanks.
|
From my investigation so far:
(defn lookup [url]
(http/get url {:pool-timeout 1
:request-timeout 1
:connection-timeout 1}))
|
I'm very close to having a fix for this, thanks for digging into it, though. |
This looks to have been some fallout from #140 which I should have caught. I've made it so that your original code, which applied I don't see any further room for this sort of issue, but it's possible there's still some corner case lurking. Please let me know if you see anything else. |
Great, thank you! |
Hi guys, Was this change released? I just spotted another issue that workers are leaking in the connection pool if in the middle of request I remove target server (so connection is not closed properly). After that
I tried to use all timeout options without any success. Thanks a lot! UPD This is minimal code snippet that I was able to reproduce the issue with: (defonce client-connection-pool
(aleph/connection-pool
{:response-executor
(flow/utilization-executor
0.9 512
{:stats-callback (partial stats-callback :client)})
:connections-per-host 7000
:total-connections 8000
:target-utilization 0.9
:stats-callback connections-stats-callback ; dumps stats in to a file
:connection-options {:keep-alive? false}}))
(->> 15000
range
(map (fn [_]
(aleph/get "http://localhost:4567"
{:follow-redirects false
:throw-exceptions false
:pool client-connection-pool
:pool-timeout 1e4
:connection-timeout 1e4
:request-timeout 4e4})))
doall
(map (fn [_] nil))) Server: require 'sinatra'
get '/' do
sleep 120
"HI"
end Killing ruby process in the middle of execution leaks workers in the pool. |
This fix was included in I'm a little unclear on the nature of your issue, though. You mention |
Connections for the connection pool are being exhausted. |
Okay, can you open a new issue for this? I'll take a look. |
created #217, thanks! |
I'm not sure if this is really a problem with aleph or with manifold, but posting it here.
The original problem I had was in a test, where I spin up an http server in a daemon, run some tests against it, and then shut it down. The problem first manifested itself as the tests passing the first time, and then failing with timing out http requests on subsequent runs with the same JVM process. A lot of tracing later, and I've boiled it down to just this gist: https://gist.github.com/benmoss/79acf300d8d2ba573648.
When you run
lookup
on an unreachable host, like in the comments at the bottom, you'll see the tracedaleph.http/create-connection
getting called repeatedly with pauses in between. If you use a reachable host, it doesn't show this problem. My hunch is that something intimeout!
isn't working properly in fully cancelling the repeat attempts onhttp/request
.The text was updated successfully, but these errors were encountered: