Skip to content

fix(pubsub): avoid max lease overflow errors - #6727

Merged
dbolduc merged 2 commits into
googleapis:mainfrom
dbolduc:fix-pubsub-clamp-max-lease
Sep 8, 2026
Merged

fix(pubsub): avoid max lease overflow errors#6727
dbolduc merged 2 commits into
googleapis:mainfrom
dbolduc:fix-pubsub-clamp-max-lease

Conversation

@dbolduc

@dbolduc dbolduc commented Sep 7, 2026

Copy link
Copy Markdown
Member

Fixes #6721

@product-auto-label product-auto-label Bot added the api: pubsub Issues related to the Pub/Sub API. label Sep 7, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a maximum lease duration clamp of 1000 years to prevent overflow errors when setting the maximum lease, and adds a corresponding unit test. The feedback suggests reducing this limit to 100 years because a 1000-year duration can still cause overflow panics when added to an Instant on platforms where Instant is represented as a 64-bit integer of nanoseconds.

Comment thread src/pubsub/src/subscriber/builder.rs Outdated
@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.71%. Comparing base (f02b42c) to head (acefe83).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6727      +/-   ##
==========================================
- Coverage   96.72%   96.71%   -0.01%     
==========================================
  Files         313      313              
  Lines      101266   101275       +9     
==========================================
+ Hits        97948    97949       +1     
- Misses       3318     3326       +8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dbolduc
dbolduc marked this pull request as ready for review September 7, 2026 18:01
@dbolduc
dbolduc requested a review from a team as a code owner September 7, 2026 18:01
@dbolduc
dbolduc merged commit 9797b2d into googleapis:main Sep 8, 2026
42 checks passed
@dbolduc
dbolduc deleted the fix-pubsub-clamp-max-lease branch September 8, 2026 03:11
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 Pub/Sub API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Subscriber set_max_lease with large Duration panics the lease-loop task

2 participants