Skip to content

Instantly share code, notes, and snippets.

@mike-plivo
Created December 22, 2011 23:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mike-plivo/1512329 to your computer and use it in GitHub Desktop.
Save mike-plivo/1512329 to your computer and use it in GitHub Desktop.
kennethreitz/requests issue 3239
"""
Some requests receive a Response but keep the socket in
CLOSE_WAIT state until process is killed .
Some requests raise ConnectionError after some time and
seem to block others unprocessed spawned requests until
all ConnectionError are not raised .
(all http connection pool slots are busy ?)
"""
from gevent import monkey
monkey.patch_all()
import gevent
import requests
def http_req(x):
r = requests.post('http://google.com')
print "Request ", x, r
if __name__ == '__main__':
reqs = [ gevent.spawn(http_req, x) for x in range(10) ]
print "waiting end of greenlets ..."
gevent.joinall(reqs)
print "sleeping for 120 sec"
gevent.sleep(120.0)
@mygoda
Copy link

mygoda commented Jan 23, 2016

do you have any solution for this problem,i struck in it so many time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment