-
Notifications
You must be signed in to change notification settings - Fork 20
Watch seems to leak connections #15
Comments
I guess it's this, from http://docs.python-requests.org/en/latest/user/advanced/#keep-alive:
But since we don't tell the server that we're no longer interested in the watch, I'm not sure there's a correct definition of "once all body data has been read", and in practice accessing I guess this is a known problem, and that this -
is trying to work around it by reaching in and closing the socket by hand. But apparently it isn't working (with Python 2, which is what I'm using). |
hey @neiljerram do you have time to throw a debugger at it? else i'll try to get to it next week |
@dims Thanks for reading and commenting! I'm happy to try debugging if you can give me a bit more guidance on what to do or look for... at the moment I'm afraid I don't know what you have in mind. |
@neiljerram oh, sorry. |
Hi @dims, I work with Neil, I'm picking this up and trying to find a workaround. I believe that I'm guessing you put the conditional there for a reason though? From the python docs:
It doesn't seem like shutdown is new, looks like it's always been there. |
@fasaxc if that works, then let's switch over to that. please make sure the unit tests work too. if i remember right, i had trouble with the unit tests too w/o that messy hack |
The previous technique used to try to force-close the watch socket didn't work on (at least) Python 2.7.12 but the old Python 3.x workaround seems to work fine on Python 2.7 as well. Use that. Fixes dims#15
I put up a PR; |
@fasaxc at some point i'll propose this to oslo. until then, this is my personal repo. |
The previous technique used to try to force-close the watch socket didn't work on (at least) Python 2.7.12 but the old Python 3.x workaround seems to work fine on Python 2.7 as well. Use that. Fixes #15
Run a local etcd server on port 2379, e.g. with
docker run --net=host quay.io/coreos/etcd
.Create an Etcd3Client and make an initial connection to the server:
Find out the PID of that python shell, and then in another window monitor its etcd connections with
You'll initially see that there is 1 connection:
Start and then cancel a watch:
The watch still shows just 1 connection.
However, now, for each further iteration of
we see 1 more ESTABLISHED connection. For example, after 8 more iterations, there are now 9 ESTABLISHED connections:
I believe this pattern continues without any bound, because in an overnight OpenStack churn test with networking-calico, the DHCP agent (which uses etcd3gw, and creates and cancels watches as above) was found to have more than 900 open connections to etcd.
The text was updated successfully, but these errors were encountered: