[bug] Test project RedisChannelLayer times out after 5s with redis-py 8
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
- #1571 @Sauvi72 による — マージされずにクローズ
評価
- 難易度
- 1/5
- 見積もり時間
- 1時間未満
- 初心者へのやさしさ
- 85/100
調査の方向性
tests/openwisp2/settings.py を開き、106-112 行目の CHANNEL_LAYERS ブロックを読んでください。修正は、単純な {REDIS_URL}/7 ホスト文字列を、socket_timeout を None に設定した dict 形式に切り替えることです。編集する前に、openwisp-notifications ですでに行われている同じ変更(commit bb156cf71)と比較してください。確認するには、redis>=8.0.0 と channels_redis をインストールし、ローカルの Redis を起動し、python tests/manage.py runserver を実行して、WebSocket 接続が ~5 秒後にコード 1011 で閉じなくなったことを確認してください。
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Python
- スター
- 800
- フォーク
- 354
- 平均マージ
- 1日 8時間
- マージ済み PR(30日)
- 15
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
openwisp/openwisp-controller のほかの issue
-
[bug] `Device.manage_devices_group_templates` aborts early when any device lacks a config対応中かも @blade0g が 4 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
openwisp/openwisp-controller#1572 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[bug] Repeated device_group_changed signal on subsequent saves of the same device instance再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
openwisp/openwisp-controller#1563 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[bug] DeviceListFilterBackend drops additional query filters when config__templates is provided対応中かも @rohanesor が 46 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
openwisp/openwisp-controller#1544 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[fix] Recent Commands row uses "created" timestamp for the "Modified" field対応中かも @xovishnukosuri が 263 日前に担当しました。 オープンbug
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
openwisp/openwisp-controller#1263 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
[bug] Recent Commands clips long inputs and formats them differently before and after reload対応中かも @vanshwadhwa24 が今日担当しました。 オープンbug
openwisp/openwisp-controller#1577 · コメント 3 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
openwisp/openwisp-controller の issue をすべて見る
似ている issue
-
fidelity
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
backlog
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
sagemathinc/sagebrush#3434 ·
メンテナーはふだん 1 日以内に返信
-
marketing
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
documentation good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
wuisabel-gif/MemWhale#576 ·
メンテナーはふだん 1 日以内に返信
-
Status: Triage Suggestion
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
GTNewHorizons/GT-New-Horizons-Modpack#27957 ·
メンテナーはふだん 1 日以内に返信