blpop with timeout=0 get stuck after a long idle time
See original GitHub issueI am using redis server v3.2.100 on windows, and redis-py v3.3.8 from both windows and ubuntu 18.04.
I got a similar problem described here: https://github.com/andymccurdy/redis-py/issues/1199
I made the redis server public on internet, and use the redis-py to blpop the elements and process.
The redis-py code I used is like:
#import redis
db = redis.StrictRedis(host='xx.xx.xx.xx', port=6379, db=0)
while True:
queue = db.blpop('detection_queue', timeout=5)
if queue is not None:
# process the queue
If I leave the redis queue empty, then after a long time t, the blpop seems to get stuck. It does not return even I push new elements into the queue. If I specify timeout=0 in db.blpop (no timeout, wait indefinitely) call, then the t is about 30 minutes If I specify timeout=5 in db.blpop (5 seconds timeout), then the t is around a couple of hours.
I could share the redis IP and port, if anybody is interested to make a test.
Thanks.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Just make sure your
socket_timeout
is higher than the timeout you’re passing toBLPOP
.thanks for your issue, also solved my problem.