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

fix: handle receipt modAck and lease extensions with exactly-once delivery correctly #1709

Merged
merged 6 commits into from
Apr 20, 2023

Conversation

feywind
Copy link
Collaborator

@feywind feywind commented Apr 13, 2023

Two fixes in this one:

  • receipt modAcks were not being handled properly in exactly-once delivery mode; they were basically being treated the same as non-EOD receipt modAcks
  • the leasing manager was not doing modAckWithResponse when extending leases, which could cause memory and CPU leaks over time for exactly-once delivery subscriptions

I also discovered that we were missing a bunch of unit tests around this stuff, so I added some more.

Fixes #1697

@feywind feywind requested review from a team as code owners April 13, 2023 17:50
@product-auto-label product-auto-label bot added size: l Pull request size is large. api: pubsub Issues related to the googleapis/nodejs-pubsub API. labels Apr 13, 2023
@feywind feywind added the owlbot:run Add this label to trigger the Owlbot post processor. label Apr 13, 2023
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Apr 13, 2023
@feywind feywind added the owlbot:run Add this label to trigger the Owlbot post processor. label Apr 16, 2023
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Apr 16, 2023
message.modAckWithResponse(deadline).catch(() => {
// In the case of a permanent failure (temporary failures are retried),
// we need to stop trying to lease-manage the message.
this.remove(message);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be setting the response for the eventual ack as failed as well. This way, when the client acks the message, we do not have to issue a server call. If the modack fails with a permanent error, ack will also fail with a permanent error.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maheshgattani Can you check the change I just made to validate that it meets the requirements? The ack/modAck/nack methods will only throw a failure if the error is permanent, so I think this covers it.

@feywind feywind added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Apr 17, 2023
@feywind feywind added owlbot:run Add this label to trigger the Owlbot post processor. and removed do not merge Indicates a pull request not ready for merge, due to either quality or timing. labels Apr 19, 2023
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Apr 19, 2023
@feywind feywind merged commit d786d22 into googleapis:main Apr 20, 2023
13 checks passed
@feywind feywind deleted the gh1678-eod-ack branch April 20, 2023 20:42
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/nodejs-pubsub API. size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exactly-once delivery should wait for the receipt modAck to succeed before proceeding
3 participants