[bug] Test project RedisChannelLayer times out after 5s with redis-py 8
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
- #1571 di @Sauvi72 — chiusa senza merge
Valutazione
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Idoneità per principianti
- 85/100
Direzione di ricerca
Apri tests/openwisp2/settings.py e leggi il blocco CHANNEL_LAYERS alle righe 106-112; la correzione consiste nel passare dalla stringa host semplice {REDIS_URL}/7 alla forma dict con socket_timeout impostato a None. Confronta con la stessa modifica già effettuata in openwisp-notifications (commit bb156cf71) prima di modificare. Per verificare, installa redis>=8.0.0 e channels_redis, avvia un Redis locale, esegui python tests/manage.py runserver e conferma che una connessione WebSocket non si chiude più con codice 1011 dopo ~5 secondi.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
In tests/openwisp2/settings.py (lines 106-112), when not TESTING, CHANNEL_LAYERS configures channels_redis.core.RedisChannelLayer with a plain Redis URL string:
if not TESTING:
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_redis.core.RedisChannelLayer",
"CONFIG": {"hosts": [f"{REDIS_URL}/7"]},
}
}
Starting with redis-py 8.0.0, the default socket timeout is 5 seconds. Because channels_redis blocks on BZPOPMIN for 5 seconds while waiting for messages on empty channels (see django/channels_redis#422), RedisChannelLayer.receive() raises redis.exceptions.TimeoutError: Timeout reading from ... after 5 seconds and Daphne closes active WebSocket connections with close code 1011.
This is the same redis-py 8 channel layer timeout issue already fixed in openwisp-notifications (bb156cf71) and reported in openwisp/openwisp-firmware-upgrader#517.
Steps To Reproduce
- Install test dependencies (
pip install -r requirements-test.txt) withredis>=8.0.0andchannels_redisand start a local Redis server. - Run the test project (
python tests/manage.py runserver). - Open a page using a WebSocket consumer backed by
RedisChannelLayer(or callawait RedisChannelLayer(hosts=["redis://localhost:6379/7"]).receive(channel)on an empty channel). - Observe
redis.exceptions.TimeoutError/ WebSocket close code1011after ~5 seconds.
Expected behavior
WebSocket connections remain open while waiting for channel messages. Updating the host configuration in tests/openwisp2/settings.py to:
"CONFIG": {
"hosts": [{"address": f"{REDIS_URL}/7", "socket_timeout": None}],
}
prevents the 5-second BZPOPMIN socket timeout while preserving Redis channel layer behavior.
System Information:
- Branch:
master - File:
tests/openwisp2/settings.py - Affected dependency:
redis-py >= 8.0.0withchannels_redis
- Lingua principale
- Python
- Stelle
- 800
- Fork
- 354
- Merge medio
- 1g 8h
- PR unite (30g)
- 15
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di openwisp/openwisp-controller
-
[bug] `Device.manage_devices_group_templates` aborts early when any device lacks a configForse già presa @blade0g l’ha presa 4 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
openwisp/openwisp-controller#1572 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[bug] Repeated device_group_changed signal on subsequent saves of the same device instanceForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
openwisp/openwisp-controller#1563 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[bug] DeviceListFilterBackend drops additional query filters when config__templates is providedForse già presa @rohanesor l’ha presa 46 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
openwisp/openwisp-controller#1544 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[fix] Recent Commands row uses "created" timestamp for the "Modified" fieldForse già presa @xovishnukosuri l’ha presa 263 giorni fa. Apertabug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
openwisp/openwisp-controller#1263 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[bug] Recent Commands clips long inputs and formats them differently before and after reloadForse già presa @vanshwadhwa24 l’ha presa oggi. Apertabug
openwisp/openwisp-controller#1577 · 3 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di openwisp/openwisp-controller
Issue simili
-
fidelity
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
backlog
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
sagemathinc/sagebrush#3434 ·
I maintainer di solito rispondono entro 1 giorno
-
marketing
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
documentation good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
wuisabel-gif/MemWhale#576 ·
I maintainer di solito rispondono entro 1 giorno
-
Status: Triage Suggestion
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
GTNewHorizons/GT-New-Horizons-Modpack#27957 ·
I maintainer di solito rispondono entro 1 giorno