Repository navigation
Fix Notifier async callback error handling - #2096
zariiii9003 merged 7 commits into
Conversation
|
Tick the box to add this pull request to the merge queue (same as
|
AI Review: Fix Notifier async callback error handling (#2096)#1912 is a valid bug: since asyncio support was added (#388), listener exceptions are dispatched outside Findings
Verdictrequest changes |
… and cover SocketCAN
|
Addressed all three review requests in 7355f0d: avoid duplicate KeyboardInterrupt/SystemExit propagation, exercise the file-descriptor path with real SocketCAN (vcan0), and add the changelog entry. Hosted verification: 21 tests and 2 subtests passed; Black and Ruff passed. Separate checks reproduced both duplicate exceptions on the previous revision and neither on the corrected revision. Reverting the FD dispatch change makes the new SocketCAN regression fail as expected. Changes and verification were AI-assisted. Ready for maintainer re-review. |
AI Review: Fix Notifier async callback error handling (#2096)Thank you for addressing all three requests from the previous review. The fix now restores Findings
Verdictrequest changes |
|
Replaced the private-internals regression with the suggested public Notifier/BufferedReader cleanup test in 69aeed2. The production implementation is unchanged. The new revision is undergoing the upstream CI matrix; I will leave the verification status to those checks. Thank you for the concrete test suggestion. |
Summary
Route listener exceptions through
Notifier._on_error()when a Notifier is using an asyncio event loop.With a loop configured, thread-backed receivers currently schedule
_on_message_received()usingcall_soon_threadsafe(). Exceptions raised by synchronous listeners therefore occur later on the event-loop thread and bypass_rx_thread()'s exception handler. Coroutine listeners have the same problem because their tasks are only discarded on completion, so task exceptions are never passed to_on_error().This change:
Notifier.exceptionand call_on_error()_on_error(), and keeps cancelled tasks quietThe existing no-loop receive-thread behavior is unchanged.
Fixes #1912.