googleapis / googleapis/google-cloud-rust
Instant + Duration overflow panic in elapsed-time retry and polling policies
- Dominant language
- Rust
- Stars
- 955
- Forks
- 144
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 279
Description
Unconfirmed. This is the result of a search with Claude, may be a false positive.
In `src/gax/src/retry_policy.rs` and `src/gax/src/polling_error_policy.rs`, deadline calculations compute `state.start + self.maximum_duration` without checked arithmetic:
https://github.com/googleapis/google-cloud-rust/blob/f02b42c2ac5720334cd2b5335824bd4166264527/src/gax/src/retry_policy.rs#L475-L478
https://github.com/googleapis/google-cloud-rust/blob/f02b42c2ac5720334cd2b5335824bd4166264527/src/gax/src/retry_policy.rs#L497-L500
https://github.com/googleapis/google-cloud-rust/blob/f02b42c2ac5720334cd2b5335824bd4166264527/src/gax/src/retry_policy.rs#L514-L517
https://github.com/googleapis/google-cloud-rust/blob/f02b42c2ac5720334cd2b5335824bd4166264527/src/gax/src/polling_error_policy.rs#L312-L315
https://github.com/googleapis/google-cloud-rust/blob/f02b42c2ac5720334cd2b5335824bd4166264527/src/gax/src/polling_error_policy.rs#L333-L336
If a caller configures a policy with `Duration::MAX` (e.g. to disable time limits), `state.start + maximum_duration` panics immediately on the first request attempt. `checked_add` should be used instead.
Contributor guide
Research direction
Start in src/gax/src/retry_policy.rs and src/gax/src/polling_error_policy.rs at the linked deadline calculations. Read how maximum_duration is configured and how retry and polling deadlines are evaluated, then reproduce the Duration::MAX case. Done means the first request attempt no longer panics when the configured duration overflows, with the relevant gax tests passing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100