[bug] Test project RedisChannelLayer times out after 5s with redis-py 8
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
- #1571 của @Sauvi72 — đã đóng, không merge
Đánh giá
- Độ khó
- 1/5
- Thời gian dự kiến
- Dưới một giờ
- Mức phù hợp với người mới
- 85/100
Hướng nghiên cứu
Mở tests/openwisp2/settings.py và đọc khối CHANNEL_LAYERS ở dòng 106-112; bản sửa là chuyển chuỗi host đơn giản {REDIS_URL}/7 sang dạng dict với socket_timeout được đặt thành None. Hãy so sánh với thay đổi tương tự đã được thực hiện trong openwisp-notifications (commit bb156cf71) trước khi chỉnh sửa. Để xác minh, hãy cài redis>=8.0.0 và channels_redis, khởi động Redis cục bộ, chạy python tests/manage.py runserver, và xác nhận rằng kết nối WebSocket không còn đóng với mã 1011 sau ~5 giây.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Python
- Star
- 800
- Fork
- 354
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 15
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của openwisp/openwisp-controller
-
[bug] `Device.manage_devices_group_templates` aborts early when any device lacks a configCó thể đã có người làm @blade0g đã nhận 4 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
openwisp/openwisp-controller#1572 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[bug] Repeated device_group_changed signal on subsequent saves of the same device instanceCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
openwisp/openwisp-controller#1563 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[bug] DeviceListFilterBackend drops additional query filters when config__templates is providedCó thể đã có người làm @rohanesor đã nhận 46 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
openwisp/openwisp-controller#1544 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[fix] Recent Commands row uses "created" timestamp for the "Modified" fieldCó thể đã có người làm @xovishnukosuri đã nhận 263 ngày trước. Đang mởbug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
openwisp/openwisp-controller#1263 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[bug] Recent Commands clips long inputs and formats them differently before and after reloadCó thể đã có người làm @vanshwadhwa24 đã nhận hôm nay. Đang mởbug
openwisp/openwisp-controller#1577 · 3 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của openwisp/openwisp-controller
Issue tương tự
-
accepted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
future-agi/future-agi#5274 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
GenericMappingTools/pygmt#5014 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Feed validator crashes with "Memory error" when validating https://www.tidyverse.org/index.xmlĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
w3c/feedvalidator#204 ·
-
[BUG][Low–Medium] founder_numbers.py silently reads a SAFE discount or pool target given as a fraction (0.2) as 0.2%Có thể đã có người làm @sumitkhond111-del đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
bmad-code-org/BMAD-METHOD#3358 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
open-mmlab/mmcv#3352 ·