-
Notifications
You must be signed in to change notification settings - Fork 937
-
Notifications
You must be signed in to change notification settings - Fork 937
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gevent seems to block redis forever with socket. getaddrinfo
when used in multiprocessing
#230
Comments
btw, I'm using
|
ok, after some further search, add |
Confirmed that I'm having this problem too and it's not anything to do with redis specifically, but any socket connection, including |
Is this a problem only when multiprocessing is in use? |
Don't know if other situations will cause it. In this case, it is. |
I had been using native threads, not multiprocessing, though the lib was loaded in order to get the cpu count. The code in question is single threaded now and I'll give this a shot again. The place where it blocked was in the main thread on process init. |
Naive forking via import gevent.monkey
gevent.monkey.patch_all()
import gipc
import socket
import redis
def block():
print 'x'
r = redis.Redis()
r.get(1)
print 'o'
s = socket.getaddrinfo("www.python.org", 80, 0, 0, socket.SOL_TCP)
p = gipc.start_process(target=block)
p.join() |
This problem also occurs when running gevent with uwsgi and the --master flag. |
The similar problem occurs for me when using grequest (gevent+request) and redis together. Any ideas about how to fix it? |
Same problem, but with httplib2. socket.getaddrinfo() in httplib2 block forever import os |
Perhaps a dumb question, but shouldn't c-ares be gevent's default resolver in the latest versions? |
I came into a problem recently, after tracing problem down, I got this code
This code will be blocked forever in
r.get(1)
.If I comment out
socket.getaddrinfo('localhost', 8001)
, it'll not be blocked.So any idea on how to solve this?
Not clear of whether this is gevent problem or redis-py problem, so I also post this issue to redis:
redis/redis-py#310
The text was updated successfully, but these errors were encountered: