-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Client connections leaked with long-poll GETs #1397
Comments
no_proto isn't the default. |
Ah - apologies, so it isn't (double negatives confused me!). Just tried enabling |
Does the response that comes back include a response body? |
PS, don't call |
@seanmonstar No, no body at all - it's a polling GET that returns when a change is detected (see under "Waiting for a change" at https://coreos.com/etcd/docs/latest/v2/api.html), and it's expected in our real use case that most of the time it would time out with no body. Thanks for the performance tip on I've tried doing some code reading and debugging but I'm finding the hyper code quite tricky to get my head around! |
This has been fixed when the |
Sorry to dispute - but pulling from the latest master (8f6931b), and switching to use Would you prefer this reopened or a new issue? |
In fact, I can repro on master by patching your new test as follows. The key is to return a chunked-encoding with no content-length and no body. With this code, the --- a/tests/client.rs
+++ b/tests/client.rs
@@ -673,8 +673,9 @@ mod dispatch_impl {
sock.set_write_timeout(Some(Duration::from_secs(5))).unwrap();
let mut buf = [0; 4096];
sock.read(&mut buf).expect("read 1");
- let body =[b'x'; 64];
- write!(sock, "HTTP/1.1 200 OK\r\nContent-Length: {}\r\n\r\n", body.len()).expect("write head");
+ // let body =[b'x'; 64];
+ let body = vec![];
+ write!(sock, "HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\n\r\n").expect("write head");
let _ = sock.write_all(&body);
let _ = tx1.send(()); |
Ah yes, this is different! Not idle connections, but rather an active connection when the |
Ok, new patch fixes the test case you provided. |
Yes, that works! Thanks so much for the speedy fixes. |
I'm not sure if this is a hyper, tokio_timer or general futures issue, it seems similar to #1353 - but that suggests this is fixed by using
no_proto
on the Client, and I see the same problem whether or not I useno_proto
.Originally raised as jimmycuadra/rust-etcd#20, but managed to isolate it to hyper.
The trigger seems to be using
tokio_timer::Timeout
on aClient.get()
that has returned the headers with Chunked-Encoding but no chunks received yet.Nothing obvious in trace-level logs.
Repro instructions (on Linux - not tried on any other platforms), mostly cribbed from the rust-etcd repo:
docker run --net=host -d quay.io/coreos/etcd:v2.2.0
works)sudo netstat - plant | grep 2379
(and eventually you'll run out of ports).The text was updated successfully, but these errors were encountered: