test: Redis topic isolation integration test can hang until the 180s timeout
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 72/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- docker, github-actions, python, redis
调研方向
Start with api/tests/test_containers_integration_tests/libs/broadcast_channel/redis/test_channel.py::TestRedisBroadcastChannelIntegration::test_topic_isolation and run the existing API integration workflow. Inspect the producer, consumer, and executor lifecycle around lines 185-226, then verify that the test completes without the 180-second hang, preserves topic isolation, and terminates consumers on failure.
由索引模型根据 Issue 内容生成。
描述
Self Checks
- I have read the Contributing Guide and Language Policy.
- This is a bug report, not a usage question.
- I have searched existing issues, including closed ones, for
test_topic_isolation. - I am submitting this report in English.
Dify version
Merge queue commit 7834f1b73ede1da92c107c1d42bc724eac682f0e, testing #42558 on September 20, 2026.
Cloud or Self Hosted
Self Hosted (Source) — GitHub Actions API integration tests, Linux, Python 3.12.3, four pytest-xdist workers, Redis 6-alpine via Testcontainers.
Steps to reproduce
Observed in merge queue run 35496444507, API Integration Tests shard 1/4.
The failing test is:
api/tests/test_containers_integration_tests/libs/broadcast_channel/redis/test_channel.py::TestRedisBroadcastChannelIntegration::test_topic_isolation
Run the API integration suite using its existing CI workflow. The failure is intermittent; a deterministic reproduction has not yet been established, and no local Docker integration run was performed for this report.
The test starts a producer before two consumers and relies on time.sleep(0.1) before publishing. There is no synchronization confirming that both Redis subscriptions are active.
✔️ Expected Behavior
Both subscriptions are ready before publishing. Each consumer receives only its own topic's message. If setup or receipt fails, subscriptions and worker threads terminate within a bounded time and the test reports the original failure.
❌ Actual Behavior
The first consumer's future.result(timeout=5.0) times out. While unwinding the ThreadPoolExecutor context, shutdown waits for a consumer that is still blocked iterating its subscription. The test ultimately hits the global 180-second timeout.
> received_by_topic1 = consumer1_future.result(timeout=5.0)
api/tests/test_containers_integration_tests/libs/broadcast_channel/redis/test_channel.py:219
...
> if lock.acquire(block, timeout):
E Failed: Timeout (>180.0s) from pytest-timeout.
FAILED .../redis/test_channel.py::TestRedisBroadcastChannelIntegration::test_topic_isolation
1 failed, 480 passed, 25 warnings in 256.35s
The other three API integration shards passed.
Suspected cause: if a consumer is scheduled late or subscription setup takes longer than 100 ms, the producer can publish before the subscription is active. Redis Pub/Sub does not replay that message, so the consumer keeps waiting. This race is present in the code and matches the observed stack; the logs do not directly establish the exact subscription/publish ordering.
Suggested fix: explicitly confirm both Redis subscriptions are active before publishing, replace the fixed sleep with synchronization, and ensure failure paths close subscriptions before executor shutdown so consumers cannot wait indefinitely. Merely increasing the sleep or global timeout would leave the race in place.
Relation to #42558: the failure was observed while that PR was in the merge queue. This test uses its own Redis container and does not depend on the PostgreSQL fixture changed by the PR. The logs provide no evidence of PostgreSQL tmpfs exhaustion; shared-runner load effects have not been ruled out. Track this test reliability issue separately from the tmpfs optimization.
- 主要语言
- TypeScript
- 星标
- 157k
- 派生
- 24.7k
- 平均合并
- 22 小时 32 分钟
- 30 天内合并 PR
- 611
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
langgenius/dify 的其他 Issue
-
Annotation Reply: a stored score threshold of 0.0 is silently replaced with 1, disabling the feature 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
langgenius/dify#42639 · 1 条评论 · 1 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 70/100
langgenius/dify#42468 · 1 条评论 · 1 个 reaction ·
-
🐞 bug
难度 2/5 1-3 小时 新手友好度 86/100
langgenius/dify#42446 · 1 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 88/100
langgenius/dify#42355 · 1 条评论 · 1 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 88/100
langgenius/dify#42350 · 1 条评论 · 1 个 reaction ·
相似的 Issue
-
calcite-components needs triage refactor
难度 2/5 1-3 小时 新手友好度 75/100
Esri/calcite-design-system#15203 ·
-
难度 2/5 1-3 小时 新手友好度 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
难度 1/5 1 小时以内 新手友好度 95/100
-
难度 2/5 1-3 小时 新手友好度 78/100
Automattic/studio#4908 ·
-
难度 2/5 1-3 小时 新手友好度 90/100