Describe the bug
When using socketio.AsyncRedisManager (or RedisManager) with the newly released redis==8.0.0 package, the application gets stuck in an infinite loop printing:
Cannot receive from redis... retrying in 1 secs
This only happens with redis==8.0.0 and appears to be caused by the change in default protocol from RESP2 to RESP3.
To Reproduce
- Install:
python-socketio (version: 5.16.3)
redis==8.0.0
- Configure
AsyncRedisManager (or RedisManager) using redis.from_url(...) with default settings (no explicit protocol argument).
- Start the Socket.IO server and any worker processes that use the same Redis manager.
- Trigger events that cause inter-process messages (so that Redis pub/sub is used).
Observed behavior
The process handling the Redis pub/sub channel gets stuck in an infinite loop, logging repeatedly:
Cannot receive from redis... retrying in 1 secs
Inter-process messaging via Redis does not work.
Expected behavior
The Redis pub/sub consumer should correctly receive and parse messages so that inter-process communication works normally, without entering a retry loop.
Root cause (analysis)
In redis-py 8.0.0, the default protocol was changed to RESP3 (protocol=3). The _redis_listen_with_retries / pub-sub consumer used by python-socketio assumes RESP2-style message structures, and fails to parse the incoming pub/sub messages when Redis is speaking RESP3. This causes the consumer to fail and re-enter the retry path continuously.
Temporary workaround
Downgrading to redis<8.0.0 restores RESP2 as the default and resolves the issue immediately.
Alternatively, forcing RESP2 when constructing the Redis client (e.g. redis.from_url(..., protocol=2)) also avoids the problem. (not tested but it should work)
Proposed fix
Until python-socketio natively supports RESP3 pub/sub message structures, the Redis-based managers should either:
- Explicitly pass
protocol=2 when instantiating the Redis client connection via redis.from_url(...), or
- Document that
redis>=8.0.0 (RESP3 default) is currently unsupported and that users must either:
- pin
redis<8.0.0, or
- explicitly pass
protocol=2 in their own Redis client configuration.
Environment
python-socketio version: 5.16.3
redis-py version: 8.0.0
- Python version:
3.12.13
- OS:
macOS Tahoe 26.5.1
Logs
Representative log output:
Cannot receive from redis... retrying in 1 secs
Additional context
The same pattern occurs in my own project when using AsyncRedisManager against Redis with RESP3 enabled. Downgrading redis-py or forcing RESP2 removes the issue immediately.
Describe the bug
When using
socketio.AsyncRedisManager(orRedisManager) with the newly releasedredis==8.0.0package, the application gets stuck in an infinite loop printing:Cannot receive from redis... retrying in 1 secsThis only happens with
redis==8.0.0and appears to be caused by the change in default protocol from RESP2 to RESP3.To Reproduce
python-socketio(version:5.16.3)redis==8.0.0AsyncRedisManager(orRedisManager) usingredis.from_url(...)with default settings (no explicitprotocolargument).Observed behavior
The process handling the Redis pub/sub channel gets stuck in an infinite loop, logging repeatedly:
Cannot receive from redis... retrying in 1 secsInter-process messaging via Redis does not work.
Expected behavior
The Redis pub/sub consumer should correctly receive and parse messages so that inter-process communication works normally, without entering a retry loop.
Root cause (analysis)
In
redis-py8.0.0, the default protocol was changed to RESP3 (protocol=3). The_redis_listen_with_retries/ pub-sub consumer used bypython-socketioassumes RESP2-style message structures, and fails to parse the incoming pub/sub messages when Redis is speaking RESP3. This causes the consumer to fail and re-enter the retry path continuously.Temporary workaround
Downgrading to
redis<8.0.0restores RESP2 as the default and resolves the issue immediately.Alternatively, forcing RESP2 when constructing the Redis client (e.g.
redis.from_url(..., protocol=2)) also avoids the problem. (not tested but it should work)Proposed fix
Until
python-socketionatively supports RESP3 pub/sub message structures, the Redis-based managers should either:protocol=2when instantiating the Redis client connection viaredis.from_url(...), orredis>=8.0.0(RESP3 default) is currently unsupported and that users must either:redis<8.0.0, orprotocol=2in their own Redis client configuration.Environment
python-socketioversion:5.16.3redis-pyversion:8.0.03.12.13macOS Tahoe 26.5.1Logs
Representative log output:
Cannot receive from redis... retrying in 1 secsAdditional context
The same pattern occurs in my own project when using
AsyncRedisManageragainst Redis with RESP3 enabled. Downgradingredis-pyor forcing RESP2 removes the issue immediately.