Closed PierreLesouhaitier closed 5 years ago
This is weird as the code of requests open and close the connection right after https://github.com/requests/requests/blob/ef88b9faa6d73bc83a07ddebc424c551d2ee671c/requests/api.py#L57
Maybe the connection is kept open at the internet router level ? It is better to use session in any case https://stackoverflow.com/questions/18466079/can-i-change-the-connection-pool-size-for-pythons-requests-module
netstat -apn
on host machine)I think you were not using the PR. We just made a new release. You can install it with
pip install https://github.com/Deepomatic/deepomatic-client-python/archive/v0.7.3.tar.gz
Basically with netstat | grep http | grep $ipofserver
you will see it increases at the beggining and then get stable. This is because the keep alive connections are closed every 100 requests. Without session its one connection per request.
So you can see that you will just get one ESTABLISHED connection per process and some TIME_WAIT connections that have been closed on server side. Also I added a less violent retry for polling tasks so connections will be closed less often. On my tests it got stable around 40 dead connections which is ok.
Since you have everything in place if you can test for me with your script that would be nice :)
Should be fine now since #22. Reopen if there is still a problem. I keep #20 open to confirm with the script.
When using the same code as in #20 even with low NUMBER_THREAD (ex : 5). There is a high number of connections opened.
When instantiating a new client at each call to
classify_one_image
, number of opened connections is kept low.It seems that the client does not close the opened connections.