Dev blocking monitor: warnings for handlers from installed packages carry no app location and cannot be acted on
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
- #7911 của @vjymisal0 — đã đóng, không merge
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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).
- Ngôn ngữ chính
- Python
- Star
- 29k
- Fork
- 1.8k
- Merge trung bình
- 3 ngày 5 giờ
- Pull request đã merge (30 ngày)
- 182
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay 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 reflex-dev/reflex
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
reflex-dev/reflex#8026 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Kept env.py failure: the "move it aside" hint is dropped and a full traceback is logged when alembic.ini uses a relative script_locationCó thể đã có người làm @MaiAditya đã nhận 13 ngày trước. Đang mởbug release-train
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
reflex-dev/reflex#7856 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
0.9.12 changelog follow-ups: the #7132 "_get_was_touched" entry describes unreachable behaviour, #7115's hasattr/getattr change is undocumented, #7131's wordingCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởrelease-train
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
reflex-dev/reflex#7260 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ClientStateVar: a component that mounts while the value is non-default never re-renders on the push back to the defaultCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
reflex-dev/reflex#6823 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation upstream
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
reflex-dev/reflex#6436 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của reflex-dev/reflex
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
superlinked/sie#1033 ·
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 76/100
apache/ponymail-foal#365 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
NousResearch/hermes-labs-plugins#116 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
gcivil-nyu-org/team-3-fall26#192 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Study plan] Study sessions can be rescheduled to any length (e.g. 72 hours) with no length checkĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
gcivil-nyu-org/team-2-fall26#159 ·
Maintainer thường phản hồi trong vòng 1 ngày