googleapis / googleapis/google-cloud-rust
Refresh-task panics cascade into unhandled panic in token_cache wait_for_next_token
- 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/auth/src/token_cache.rs`, `wait_for_next_token` awaits changes from the background refresh task watch channel:
https://github.com/googleapis/google-cloud-rust/blob/f02b42c2ac5720334cd2b5335824bd4166264527/src/auth/src/token_cache.rs#L90-L93
If the background refresh task panics for any reason (such as an unhandled panic during response parsing or expiry calculation), the `tx_token` sender is dropped.
When the sender drops, `rx_token.changed().await` returns `Err(RecvError)`. Calling `.unwrap()` on this error panics inside the calling task/thread, turning background worker panics into cascading application crashes.
Contributor guide
Research direction
Start in src/auth/src/token_cache.rs at wait_for_next_token and the referenced watch-channel await around lines 90–93. Trace what happens when the background refresh task drops tx_token, then check the auth tests for a place to cover that condition. Done means a refresh-task panic or sender drop does not cause a cascading unhandled panic in the waiting task.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- authentication
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100