fix(receiver): harden callback draining during shutdown#644
Open
GefMar wants to merge 1 commit into
Open
Conversation
- keep callback tasks owned until cleanup completes - prevent AnyIO level-cancellation busy loops - preserve interruptible unbounded graceful waits - release execution capacity exactly once - clarify wait-tasks-timeout semantics - add deterministic lifecycle and cancellation tests
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #644 +/- ##
==========================================
+ Coverage 81.29% 81.86% +0.56%
==========================================
Files 69 69
Lines 2577 2619 +42
==========================================
+ Hits 2095 2144 +49
+ Misses 482 475 -7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Problem
Receiver callbacks could become orphaned or remain incompletely drained during worker shutdown.
The issue occurs when a message callback is still running while the receiver is being cancelled, especially when:
--wait-tasks-timeoutexpires;SIGINTorSIGTERM;In these cases, cancellation could interrupt the callback-draining path itself. This could leave callback work without a clear owner, skip cleanup, or release prefetch capacity incorrectly. Repeated AnyIO cancellation could also cause a busy loop while the receiver attempted to finish cancellation cleanup.