Too many open files
I am building a basic load generator and started running into file descriptor limits, I havent seen any documentation pertaining to how to release resources, so either I am doing it wrong and the docs need updated, or requests is leaking file descriptors somewhere (without support for keepalive I am slightly confused at why any files would be left open at all)
Where you using requests.async?
nope, all requests were reasonably plain requests.get / requests.post, I am still seeing a few in there
$ lsof | grep localhost | wc -l
110
all but 4/5 of them are of the format
Python 82117 daleharvey 123u IPv4 0xffffff800da304e0 0t0 TCP localhost:61488->localhost:http (CLOSE_WAIT)
I'm a bit baffled by this, to be honest.
Hah ill take another shot at reproducing it reliably, if I cant ill close
I've seen this happening to me, but only when I'm using the async module w/ 200+ simultaneous connections.
Hi, I got exactly the same problem using requests and monkey patching with gevent : some connections staying in CLOSE_WAIT . Maybe a problem with gevent so .
It may be problem of ulimit -n. Try with a higher value.
"Too many open files" is the result of the bug caused by sockets staying in CLOSE_WAIT . So ulimit won't fix just make a workaround .
@tamiel how do we fix this?
I will do more tests asap and try to fix .
I've looked into it, and seems to be a problem with all libraries using httplib.HTTPSConnection.
Posted an example here :
https://gist.github.com/1512329
I just encountered a very similar error using an async pool with only HTTP connections - I'm still investigating but passing a pool size to async.map makes the error reproduce quickly.
Any fixes to this? This makes Requests unusable with gevent..
It's all about the CLOSE_WAITs. Just have to close them. I'm not sure why they're still open though.
Is it a urllib3 issue? Having to close these by ourselves isnt a great idea i feel.
It's more of a general issue. We can keep the conversation here.
Ok just to give you a perspective, we are trying to move from httplib2 to requests, and we dont see this issue with httplib2. So its not a general issue for sure.
By general i mean that it's a very serious issue that effects everyone involved.
so how do we solve this? we really want to use requests + slumber moving forward