You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
then the wget request will time out, but netstat will show a connection staying up between the etcd proxy and the master. If you make enough wget requests, etcd will eventually run out of file handles.
This was regressed by 9def4cb. I've confirmed that by running the above command sequence with an etcd built from that commit - which did leak a connection - and from its parent, which didn't.
That commit:
doesn't call cancel() on the request when it detects that the client connection has been closed
instead, it has defer cancel() so the request is cancelled when the function exits. (This is necessary according to https://golang.org/pkg/context/#WithCancel - "Canceling this context releases resources associated with it, so code should call cancel as soon as the operations running in this Context complete.")
however, if the client connection is closed but cancel() isn't called, the io.Copy on the final line blocks forever, so the function never exits and cancel() isn't called.
Fortunately, cancel() can be called multiple times safely (https://golang.org/pkg/context/#CancelFunc - "After the first call, subsequent calls to a CancelFunc do nothing."), so the fix should just be to reinstate the cancel() when we detect that the connection has closed, alongside the defer cancel().
The text was updated successfully, but these errors were encountered:
Since etcd v3.2.0, if you run the following:
then the wget request will time out, but netstat will show a connection staying up between the etcd proxy and the master. If you make enough wget requests, etcd will eventually run out of file handles.
This was regressed by 9def4cb. I've confirmed that by running the above command sequence with an etcd built from that commit - which did leak a connection - and from its parent, which didn't.
That commit:
cancel()
on the request when it detects that the client connection has been closeddefer cancel()
so the request is cancelled when the function exits. (This is necessary according to https://golang.org/pkg/context/#WithCancel - "Canceling this context releases resources associated with it, so code should call cancel as soon as the operations running in this Context complete.")cancel()
isn't called, theio.Copy
on the final line blocks forever, so the function never exits andcancel()
isn't called.Fortunately,
cancel()
can be called multiple times safely (https://golang.org/pkg/context/#CancelFunc - "After the first call, subsequent calls to a CancelFunc do nothing."), so the fix should just be to reinstate thecancel()
when we detect that the connection has closed, alongside thedefer cancel()
.The text was updated successfully, but these errors were encountered: