GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — pubsub: reject expired and duplicate messages by pongad · Pull Request #3743 · googleapis/google-cloud-java

Conversation

@pongad

@pongad pongad commented Sep 27, 2018

Copy link
Copy Markdown
Contributor

CC @csainty

This should let us clear through backlogs more quickly.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@pongad
pubsub: reject expired and duplicate messages
aa852ff
@pongad
pongad requested review from JesseLovelace and chingor13 September 27, 2018 19:32
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Sep 27, 2018
csainty
csainty reviewed Sep 27, 2018
View reviewed changes
Comment thread ...-clients/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/MessageDispatcher.java
if (ackHandler.totalExpiration.isBefore(now())) {
// Message expired while waiting. We don't extend these messages anymore,
// so it was probably sent to someone else. Don't work on it.
// Don't nack it either, because we'd be nacking someone else's message.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

csainty
csainty reviewed Sep 27, 2018
View reviewed changes
Comment thread ...-clients/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/MessageDispatcher.java

// forget removes from pendingMessages; this is OK, concurrent maps can
// handle concurrent iterations and modifications.
entry.getValue().forget();

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@csainty

csainty commented Sep 27, 2018

Copy link
Copy Markdown

Generally like it, nice clean approach 👍

Won't handle a 0 extension period though will it? Since totalExpiration will be set to receive time

final Subscriber subscriber = Subscriber.newBuilder(subscriptionName, (msg, ack) -> {
    // do something
  })
  .setMaxAckExtensionPeriod(Duration.ZERO)
  .build();
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pongad

pongad commented Sep 27, 2018

Copy link
Copy Markdown
Contributor Author

That's right. This won't handle the case where max ack extension is zero. I'm a little concerned by this; this essentially changes the behavior from "we won't extend these" to "we'll never work on these". I'll make a small fix for this.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pongad
add some lag time before rejecting expired messages
f1e37ac
@csainty

csainty commented Sep 28, 2018

Copy link
Copy Markdown

👍
I pulled this morning and ran my sample project with the build, hits exactly-once consumption. Thanks for looking in to it.

I think this will fix #3383 and #2465
Also make it easier to configure for https://github.com/GoogleCloudPlatform/google-cloud-java/issues/3152 by tweaking the max deadline so all the messages don't pull to a single subscriber and stay there, as currently reducing the max deadline to prevent this gets you in to double processing sadness.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@csainty csainty mentioned this pull request Sep 28, 2018
[PubSub] Avoid processing pubsub messages whose ack deadline has already expired #3734
Closed
@pongad pongad mentioned this pull request Sep 28, 2018
Pubsub acks are unsuccessful #3567
Closed
@pongad

pongad commented Sep 28, 2018

Copy link
Copy Markdown
Contributor Author

Don't merge this yet. Someone from pubsub should take a look.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kamalaboulhosn
kamalaboulhosn reviewed Oct 1, 2018
View reviewed changes
Comment thread ...-clients/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/MessageDispatcher.java
@Override
public void run() {
try {
if (ackHandler.totalExpiration.plusSeconds(messageDeadlineSeconds.get()).isBefore(now())) {

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kamalaboulhosn
kamalaboulhosn approved these changes Oct 2, 2018
View reviewed changes
@pongad pongad mentioned this pull request Oct 5, 2018
PubSub Subscriber will not stop when messages have not been acked or nacked #3752
Closed
loverme12
loverme12 approved these changes Oct 12, 2018
View reviewed changes
@pongad
Merge branch 'master' into pubsub-old-msg
9c3ceb8
@pongad
pongad requested a review from a team October 18, 2018 00:46
@chingor13
Merge branch 'master' into pubsub-old-msg
3bb17b8
chingor13
chingor13 approved these changes Oct 18, 2018
View reviewed changes
@pongad
pongad merged commit db9d244 into googleapis:master Oct 18, 2018
@pongad
pongad deleted the pubsub-old-msg branch October 18, 2018 21:27
@JesseLovelace JesseLovelace mentioned this pull request Oct 25, 2018
Release v0.68.0 #3857
Merged
This was referenced Dec 4, 2018
Pub/Sub streamingPull subscriber: large number of duplicate messages, modifyAckDeadline calls observed #2465
Closed
Pub/Sub StreamingPull receives many duplicates when there is a backlog #3383
Closed
suztomo pushed a commit that referenced this pull request Mar 9, 2026
@renovate-bot
chore(deps): update dependency com.google.cloud:google-cloud-bigtable…
0700175
… to v2.57.3 (#3743)
lqiu96 pushed a commit that referenced this pull request Mar 20, 2026
@renovate-bot
chore(deps): update dependency com.google.cloud:google-cloud-bigtable…
b0c6436
… to v2.57.3 (#3743)
chingor13 pushed a commit that referenced this pull request Mar 24, 2026
@diegomarquezp
fix(hermetic-build): use correct image name in templated graalvm jobs (…
c71223d
…#3743)

Fixes a typo in two image references on templates.
chingor13 pushed a commit that referenced this pull request Mar 24, 2026
@release-please
chore(main): release 2.56.0 (#3715)
741d398
🤖 I have created a release *beep* *boop*
---


<details><summary>2.56.0</summary>

##
[2.56.0](googleapis/sdk-platform-java@v2.55.1...v2.56.0)
(2025-04-18)


### Features

* Selective gapic generation phase II
([#3730](googleapis/sdk-platform-java#3730))
([d4bafa0](googleapis/sdk-platform-java@d4bafa0))


### Bug Fixes

* **hermetic-build:** use correct image name in templated graalvm jobs
([#3743](googleapis/sdk-platform-java#3743))
([c71223d](googleapis/sdk-platform-java@c71223d))
* plumb mtls endpoint to TransportChannelProvider
([#3673](googleapis/sdk-platform-java#3673))
([d7daf89](googleapis/sdk-platform-java@d7daf89))


### Dependencies

* add opentelemetry gcp-resources to shared deps
([#3722](googleapis/sdk-platform-java#3722))
([4b94c7d](googleapis/sdk-platform-java@4b94c7d))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
meltsufin pushed a commit that referenced this pull request Apr 29, 2026
@pongad
pubsub: reject expired and duplicate messages (#3743)
22f11e5
* pubsub: reject expired and duplicate messages

* add some lag time before rejecting expired messages
meltsufin pushed a commit that referenced this pull request May 1, 2026
@pongad
pubsub: reject expired and duplicate messages (#3743)
064700a
* pubsub: reject expired and duplicate messages

* add some lag time before rejecting expired messages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@chingor13 chingor13 chingor13 approved these changes
@JesseLovelace JesseLovelace Awaiting requested review from JesseLovelace
+3 more reviewers
@csainty csainty csainty left review comments
@kamalaboulhosn kamalaboulhosn kamalaboulhosn approved these changes
@loverme12 loverme12 loverme12 approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@pongad @csainty @chingor13 @kamalaboulhosn @loverme12 @googlebot
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.