fix(event): suppress native asyncio.QueueShutDown on Python 3.13+ - #6773
fix(event): suppress native asyncio.QueueShutDown on Python 3.13+#6773axelray-dev wants to merge 3 commits into
Conversation
Greptile SummaryThis PR fixes a Python 3.13+ regression where
Confidence Score: 5/5Safe to merge — the change is narrowly scoped to exception handling during shutdown, with no behavioural impact on the hot path. The fix is minimal and targeted: it replaces a single exception class with a version-aware tuple in two catch sites, pre-3.13 behaviour is completely unchanged, and a new regression test directly exercises the 3.13+ code path. Files Needing Attention: No files require special attention.
|
| Filename | Overview |
|---|---|
| packages/reflex-base/src/reflex_base/event/processor/event_processor.py | Introduces _QUEUE_SHUTDOWN_ERRORS tuple to correctly catch the native asyncio.QueueShutDown (Python 3.13+) alongside the local subclass, fixing uncaught exceptions during shutdown |
| tests/units/reflex_base/event/processor/test_event_processor.py | Adds a Python 3.13+-only regression test that verifies native asyncio.QueueShutDown is suppressed in both _process_queue and the queue task awaited during stop, asserting telemetry/console errors are not emitted |
| packages/reflex-base/news/6773.bugfix.md | Changelog entry for the bugfix; missing trailing newline (cosmetic) |
Reviews (2): Last reviewed commit: "add news fragment" | Re-trigger Greptile
Merging this PR will not alter performance
Comparing Footnotes
|
Summary
On Python 3.13+,
asyncio.Queue.shutdown()makesqueue.get()raise the stdlibasyncio.QueueShutDown. EventProcessor only suppressed a local subclass of that exception, so the native instance was treated as an unexpected processor error and could emit error logs/telemetry during normal stop.Changes
asyncio.QueueShutDown(when present) in_process_queueandstop.QueueShutDownfallback for artificial raises.Verification
uv run pytest tests/units/reflex_base/event/processor/test_event_processor.py -q(37 passed)Backwards compatibility
No public API change. Pre-3.13 behavior unchanged. Stop still drains and cancels as before; only expected shutdown exceptions are ignored correctly.
Fixes #6756