Django Channels WebSocket Redis Timeout Error on Arch Linux (Valkey)

I’m getting a Redis timeout error when trying to use Django Channels WebSocket with Valkey on Arch Linux.

Error:
TimeoutError: Timeout reading from 127.0.0.1:6379
redis.exceptions.TimeoutError: Timeout reading from 127.0.0.1:6379

Setup:

  • Arch Linux with Valkey installed and running
  • Django 6.0 with channels_redis
  • Daphne as ASGI server
  • DEBUG = False in production mode (uses RedisChannelLayer)

Traceback:
channels/consumer.py → channels/routing.py → jwt_auth.py → channels/security/websocket.py → Redis connection fails

CHANNEL_LAYERS config:

CHANNEL_LAYERS = {
    "default": {
        "BACKEND": "channels_redis.core.RedisChannelLayer",
        "CONFIG": {
            "hosts": [os.getenv("REDIS_URL", "redis://localhost:6379/1")],
        },
    },
}
WebSocket connects and authenticates successfully, but immediately fails with Redis timeout.
Valkey is running (systemctl status valkey shows active). What could be causing this timeout?

I don’t have any specific ideas, just a few things to check.

  1. Do you get the same results when testing locally?
  2. Have you verified that Valkey is working by using the cli to connect to it and issue commands?
  3. Have you checked all potential logs for errors? (syslog, Daphne log, Valkey log)
  4. Do you have a simple pure-python program to test a couple of basic commands with Valkey?
  5. Have you used wireshark (or tcpdump) to monitor the traffic between daphne and Valkey?
  6. Have you verified your consumer/Daphne with Redis instead of Valkey?