googleapis / googleapis/google-cloud-rust
Clean server close of bidi read stream treated as success with pending ranges
- 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/storage/src/storage/bidi/worker.rs`, when the server closes the bidi read stream, `Worker::run` handles `Ok(None)` by returning `Ok(())`:
https://github.com/googleapis/google-cloud-rust/blob/f02b42c2ac5720334cd2b5335824bd4166264527/src/storage/src/storage/bidi/worker.rs#L74
https://github.com/googleapis/google-cloud-rust/blob/f02b42c2ac5720334cd2b5335824bd4166264527/src/storage/src/storage/bidi/worker.rs#L98-L101
The worker returns success without verifying that `self.ranges` is empty. Any pending readers observe a stream EOF and treat the truncated read as success.
Furthermore, exiting `Worker::run` drops the `requests` channel receiver while the parent `ObjectDescriptor` remains live. Any subsequent `read_range()` call on the `ObjectDescriptor` panics on `.expect("worker never exits while ObjectDescriptor is live")`:
https://github.com/googleapis/google-cloud-rust/blob/f02b42c2ac5720334cd2b5335824bd4166264527/src/storage/src/storage/bidi/transport.rs#L135-L138
Contributor guide
Research direction
Read Worker::run in src/storage/src/storage/bidi/worker.rs, especially its Ok(None) handling, then trace read_range() and the request channel in src/storage/src/storage/bidi/transport.rs. Confirm the behavior with pending ranges and a later read_range() call; done means truncated reads are not reported as successful and a live ObjectDescriptor does not panic after clean server closure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100