fix(pubsub): handle shutdown behavior for publisher#4622
Merged
suzmue merged 4 commits intogoogleapis:mainfrom Feb 10, 2026
Merged
fix(pubsub): handle shutdown behavior for publisher#4622suzmue merged 4 commits intogoogleapis:mainfrom
suzmue merged 4 commits intogoogleapis:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4622 +/- ##
==========================================
- Coverage 95.03% 95.02% -0.02%
==========================================
Files 195 195
Lines 7473 7477 +4
==========================================
+ Hits 7102 7105 +3
- Misses 371 372 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dbolduc
approved these changes
Feb 10, 2026
| } | ||
| } | ||
|
|
||
| #[tokio::test] |
Member
There was a problem hiding this comment.
nit: start_paused = true
We don't want to race with the batch timer, however unlikely that is to fire first
| handles.push(handle); | ||
| } | ||
|
|
||
| background_task_handle.abort(); |
Member
There was a problem hiding this comment.
good idea to test this sort of thing
PhongChuong
approved these changes
Feb 10, 2026
| .expect("publisher should not close the sender for PublishFuture") | ||
| .map_err(convert_error), | ||
| ) | ||
| // which can happen when the background worker is dropped. |
Collaborator
There was a problem hiding this comment.
Suggested change
| // which can happen when the background worker is dropped. | |
| // which can happen when the dispatcher is dropped. |
Collaborator
Author
|
Going to address the comments in a follow up PR, because I'd like this fix to land in the release if possible. |
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.
During the normal flow of using a publisher, the background task itself should not be dropped. When the task containing the Publisher is shutting down however, the background task may be forcefully aborted before the task that is processing the results of the publish. This will result in any resources owned by the background task to be dropped, including the channel for processing incoming publish requests and any oneshot channels to be resolved for publish requests. This means that the
PublishFuturemust be able to handle the case where these resources are dropped without panicking.Fixes #4483