Dev blocking monitor: warnings for handlers from installed packages carry no app location and cannot be acted on
维护者通常 1 天内回复
还没有人认领这个 Issue。
- #7911 来自 @vjymisal0 —— 已关闭,未合并
评估
调研方向
Read packages/reflex-base/src/reflex_base/event/processor/blocking.py, focusing on _describe_blocking and the warning in _run; check the existing app-location lookup and the blocking-monitor unit tests. Reproduce with a handler whose __module__ is outside the app directory. Done when third-party handler warnings identify their source and show a shorter stack, with tests covering the behavior and app-owned warnings unchanged.
由索引模型根据 Issue 内容生成。
描述
Problem
The 0.11 dev event-loop blocking monitor (#7672) warns when an event handler blocks the loop past event_loop_blocking_threshold (0.2 s). For handlers that live in a third-party package the warning is accurate but not actionable. With reflex-local-auth 0.5.0, every login prints a ~30-line warning:
Warning: Event handler LoginState.on_submit is blocking the event loop (threshold: 0.200s). Move blocking I/O to a thread pool or use a non-blocking async API.
Blocking stack (most recent call last):
... (site-packages frames) ...
bcrypt.checkpw(...)
bcrypt.checkpw takes 0.27-0.30 s. The warning has no app file or line (the handler is in site-packages), it does not say which package the handler belongs to, and the app developer cannot fix it. In a 38-step test run it was printed 7 times. The only way to silence it is to turn the monitor off for the whole app (event_loop_blocking_threshold=0).
Repro
pip install reflex reflex-local-auth, build the reflex-local-auth demo (register + login pages), reflex run (dev), log in a few times. Each login prints the warning above.
Expected
- When no frame of the blocking stack is in the app's own code, the warning says so and names the distribution or top-level module the handler comes from, e.g. "Event handler LoginState.on_submit (from package reflex_local_auth) is blocking the event loop ...", and prints a short stack (from the first non-reflex frame) instead of the full one.
- A way to silence known third-party handlers without disabling detection for the app, for example a config list of module prefixes to ignore, or reporting each third-party handler only once per process.
Fix direction
- Code:
packages/reflex-base/src/reflex_base/event/processor/blocking.py(_describe_blocking, the warning in_run), andpackages/reflex-base/src/reflex_base/config.pyif a new option is added. - Determine "app code" the same way the existing app-location lookup does (the innermost frame under the app's directory); when none is found, derive the owning package from the handler function's
__module__. - A new config option is public API; if added, document it in
docs/advanced_onboarding/configuration.mdnext toevent_loop_blocking_threshold. Reporting third-party handlers once per process needs no new API and may be enough. - Non-goals: no change in prod (the monitor is dev-only); no change to warnings for app-owned handlers.
- Tests: unit tests in the blocking-monitor test module with a handler whose
__module__is outside the app directory.
Not a regression (the monitor is new in 0.11).
- 主要语言
- Python
- 星标
- 29k
- 派生
- 1.8k
- 平均合并
- 3 天 5 小时
- 30 天内合并 PR
- 182
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
reflex-dev/reflex 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 78/100
reflex-dev/reflex#8026 · 1 条评论 ·
维护者通常 1 天内回复
-
Kept env.py failure: the "move it aside" hint is dropped and a full traceback is logged when alembic.ini uses a relative script_location可能已有人在做 @MaiAditya 于 13 天前认领。 未关闭bug release-train
难度 2/5 1-3 小时 新手友好度 78/100
reflex-dev/reflex#7856 · 1 条评论 ·
维护者通常 1 天内回复
-
0.9.12 changelog follow-ups: the #7132 "_get_was_touched" entry describes unreachable behaviour, #7115's hasattr/getattr change is undocumented, #7131's wording可能重新可做 关联的 PR 已关闭且未合并。 未关闭release-train
难度 2/5 1-3 小时 新手友好度 70/100
reflex-dev/reflex#7260 · 2 条评论 ·
维护者通常 1 天内回复
-
ClientStateVar: a component that mounts while the value is non-default never re-renders on the push back to the default可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
reflex-dev/reflex#6823 · 1 条评论 ·
维护者通常 1 天内回复
-
documentation upstream
难度 2/5 1-3 小时 新手友好度 62/100
reflex-dev/reflex#6436 · 3 条评论 ·
维护者通常 1 天内回复
查看 reflex-dev/reflex 的全部 Issue
相似的 Issue
-
todo
难度 1/5 1 小时以内 新手友好度 72/100
tonybaloney/CSnakes#864 ·
-
infra
难度 1/5 1 小时以内 新手友好度 90/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
libre-embedded/svgen#72 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
Genesis-Embodied-AI/genesis-world#3950 ·
维护者通常 1 天内回复
-
accessibility
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复