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

Assert fails with duplicate AckRequests #661

Closed
acocuzzo opened this issue Apr 19, 2022 · 1 comment · Fixed by #662
Closed

Assert fails with duplicate AckRequests #661

acocuzzo opened this issue Apr 19, 2022 · 1 comment · Fixed by #662
Assignees
Labels
api: pubsub Issues related to the googleapis/python-pubsub API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@acocuzzo
Copy link
Contributor

acocuzzo commented Apr 19, 2022

Steps to reproduce

  1. Ack the same message multiple times on a streaming pull subscription.

This assertion fails when ack duplication occurs:

There is no de-duplication of acks in the dispatcher, and because ack_reqs_dict is a Dict[str, AckRequest], the latest AckRequest will replace an earlier request.

The solution is either to change ack_req_dict to allow for multiple AckRequests for the same message, or to de-duplicate acks in the dispatcher.

@acocuzzo acocuzzo added the type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. label Apr 19, 2022
@product-auto-label product-auto-label bot added the api: pubsub Issues related to the googleapis/python-pubsub API. label Apr 19, 2022
@acocuzzo acocuzzo self-assigned this Apr 19, 2022
@acocuzzo acocuzzo added the priority: p2 Moderately-important priority. Fix may not be included in next release. label Apr 19, 2022
@simonvanderveldt
Copy link

I think we're running into the same issue as this

Acking message 4497448654197332
ERROR:google.cloud.pubsub_v1.subscriber._protocol.helper_threads:Error in queue callback worker:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/google/cloud/pubsub_v1/subscriber/_protocol/helper_threads.py", line 118, in __call__
    self._callback(items)
  File "/usr/local/lib/python3.7/site-packages/google/cloud/pubsub_v1/subscriber/_protocol/dispatcher.py", line 159, in dispatch_callback
    self.ack(ack_requests)
  File "/usr/local/lib/python3.7/site-packages/google/cloud/pubsub_v1/subscriber/_protocol/dispatcher.py", line 192, in ack
    ack_reqs_dict=ack_reqs_dict,
  File "/usr/local/lib/python3.7/site-packages/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py", line 588, in send_unary_ack
    assert len(ack_ids) == len(ack_reqs_dict)
AssertionError

I'm not aware that we're acking multiple times. I mean the message is still there so we try again when we rerun the application that acks it, but this also happend the first time we encountered this message as far as I know. It does only happen every now and then for us, not sure how to reproduce.
Bug was introduced by #550, we've reverted back to 2.9.0 which was the last version before that change and that's working fine.

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. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants