Skip to content
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

unclear redis block forever problem with socket, multiprocessing and gevent #310

Closed
lxyu opened this issue Jan 7, 2013 · 1 comment
Closed

Comments

@lxyu
Copy link

lxyu commented Jan 7, 2013

I came into a problem recently, after tracing problem down, I got this code

# -*- coding: utf-8 -*-

import gevent.monkey
gevent.monkey.patch_all()

import socket
import redis
import multiprocessing


def block():
    print 'x'
    r = redis.Redis()
    r.get(1)
    print 'o'


socket.getaddrinfo('localhost', 8001)

p = multiprocessing.Process(target=block)
p.start()
p.join()

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?

btw, I'm using

gevent==1.0rc2
redis==2.7.2

Not clear of whether this is gevent problem or redis-py problem, so I also post this issue to gevent:
https://github.com/SiteSupport/gevent/issues/230

@lxyu
Copy link
Author

lxyu commented Jan 8, 2013

ok, now I'm clear this is a gevent problem. close it here.

@lxyu lxyu closed this as completed Jan 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant