Skip to content

blpop blocked forever #1331

@kingname

Description

@kingname

Thanks for wanting to report an issue you've found in redis-py. Please delete this text and fill in the template below.
It is of course not always possible to reduce your code to a small test case, but it's highly appreciated to have as much data as possible. Thank you!

Version: What redis-py and what redis version is the issue happening on?

redis-py: 3.4.1
redis_version:4.0.9, single instance.

Platform: What platform / version? (For example Python 3.5.1 on Windows 7 / Ubuntu 15.10 / Azure)

Ubuntu 19.04
Python 3.7.3

Description: Description of your issue, stack traces from errors and code that reproduces the issue

My code:

import redis
client = redis.Redis()
while True:
    data = client.blpop('key', timeout=5 * 60)
    if not data:
        continue
    parse(data[1])

sometime, this code will block forever even if there are many datas in the list. Especially when the list is empty for a long time, and then I lpush some data to it, the code could not read data from list, just blocks here. I must restart the program, then it could continue to consume.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions