question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

blpop with timeout=0 get stuck after a long idle time

See original GitHub issue

I 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:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
andymccurdycommented, Aug 31, 2019

Just make sure your socket_timeout is higher than the timeout you’re passing to BLPOP.

0reactions
kingnamecommented, Sep 20, 2019

thanks for your issue, also solved my problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

blpop with timeout=0 get stuck after a long idle time #1210
I 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...
Read more >
blpop stops processing queue after a while - Stack Overflow
The workers which have been running for a long time have stopped processing the queue. After running CLIENT LIST we noticed that these...
Read more >
lettuce-io/Lobby - Gitter
Looking at the command sequence, although BLPOP times out, the connection is still blocked because a client-side timeout does not affect the server...
Read more >
BLPOP - Redis
The timeout argument is interpreted as a double value specifying the maximum number of seconds to block. A timeout of zero can be...
Read more >
Welcome to redis-py's documentation! — redis-py 2.10.5 ...
The range is interpreted as a range of bytes and not a range of bits, so start=0 and end=2 means to look at...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found