Repository navigation
Notifier: route listener exceptions only to the failing listener's on_error - #2183
Merged
zariiii9003 merged 3 commits intoDec 5, 2026
Merged
zariiii9003 merged 3 commits into
zariiii9003 merged 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
can.Notifiernow callson_error()of that listener only and keeps delivering the message to all other listeners.stop(). It no longer kills the receive thread (threaded mode) or reports to the event loop's exception handler (asyncio mode).on_error()itself is logged and counts as "not handled", also for bus receive errors.Notifier.__init__,Listener.on_errorandNotifier.exception.Related Issues / Pull Requests
on_error())Type of Change
Listener.on_errorsemantics, see Additional NotesChecklist
tox).Additional Notes
Evidence
Behaviour on
mainvs this PR (virtual bus, one listener that raisesValueErroron every message):mainBufferedReader[][0, 1, 2]AsyncBufferedReaderget_message()raises the callable'sValueErrorinstead of returning messages[0, 1]on_errorTests in
test/notifier_test.pycover per-listener routing, continued delivery, removal andstop()of the failed listener, failingon_error()/stop(), and no secondstop()when a coroutine fails afterNotifier.stop(). They wait on events instead of fixed sleeps, so they don't depend on CI scheduling.Merge Danger
Door: two-way. Code-only change, revertible without data or API migration.
Blast Radius: error-handling consumers.
The last row of the table changes v4.6.1 behaviour:
Listener.on_errorwas documented as handling "any exception in the receive thread", so a listener withon_errorcould keep a raising sibling alive. That no longer works. A listener must implementon_error()itself to survive its own exceptions. Keeping the old routing would preserve theAsyncBufferedReadermisrouting (row 2), so the change is intended. The news fragment describes the migration.🤖 Generated with AI