Skip to content

pubsub.listen() fails to receive new messages after 5-10 mins of channel inactivity. #1427

@kmorris81

Description

@kmorris81

Version: Redis Server = 6.0.6. | redis-py = 3.5.3
Platform: Python 3.7.0 on Windows 10 1909

Sample code:

import redis
r = redis.Redis(host="<redis_ip>", port=<port>, decode_responses=True, client_name="WinSubFail")
p = r.pubsub(ignore_subscribe_messages=True)
p.subscribe("my.test.channel")
for m in p.listen():
    print(m)

On Windows, after a period 5-10 minutes of inactivity on the "my.test.channel", new/subsequent messages will fail to be received by the listen() function.
On Linux (Ubuntu 18.04), the same code will run successfully forever. Hours/days of inactivity can go by and all new messages will be received and printed.

The Redis server still appears to know about the "WinSubFail" client connection as it exists in the output of CLIENT LIST.
I tried several variations of socket_keepalive with socket_keepalive_options values but did not seem to have any affect.

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