Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publisher Client does not enter paused state before future.set_exception #1144

Open
mukund-ananthu opened this issue Apr 14, 2024 · 0 comments · May be fixed by #1145
Open

Publisher Client does not enter paused state before future.set_exception #1144

mukund-ananthu opened this issue Apr 14, 2024 · 0 comments · May be fixed by #1145
Assignees
Labels
api: pubsub Issues related to the googleapis/python-pubsub API.

Comments

@mukund-ananthu
Copy link
Contributor

For non-retriable errors returned from the backend, the client library currently sets future.set_exception() for all outstanding futures:

for future in self._futures:
future.set_exception(exc)

before it tries to change its state to paused by calling the _batch_done_callback():

if self._batch_done_callback is not None:
# Failed to publish batch.
self._batch_done_callback(batch_transport_succeeded)

This results in race conditions where the callback associated with the future is invoked before the client enters paused state. Which causes issues if the callback attempts to do a resume_publish() before the client is in the paused state.

@mukund-ananthu mukund-ananthu self-assigned this Apr 14, 2024
@product-auto-label product-auto-label bot added the api: pubsub Issues related to the googleapis/python-pubsub API. label Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the googleapis/python-pubsub API.
Projects
None yet
1 participant