Repository navigation
Conversation
When a stream breaks after its last byte, the layer advances the range to size zero and reopens with it. Nothing is left to fetch, and an empty range has no valid Range header. Return an empty buffer instead, which callers treat as end of stream. An unbounded read has no size to compare against, so it still reopens past the end. Catching that needs the object size.
1 of 2 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When a stream breaks after its last byte, the layer advances the range to size zero and reopens with it. Nothing is left to fetch, and an empty range has no valid Range header.
Return an empty buffer instead, which callers treat as end of stream.
An unbounded read has no size to compare against, so it still reopens past the end. Catching that needs the object size.
Which issue does this PR close?
Closes #8342
Rationale for this change
RetryReadStream::readadvances the range by what it has read before reopening. If the stream breaks after the last byte, the range is already empty by then, and it reopens with it. Nothing is left to fetch.With a
LoggingLayerin the stack that panics, because the layer callsto_string()on the range andDisplayreturnsErrfor a zero size.ErrorContextLayerdoes the same on its error path. Without either, the request goes out with an emptyRangeheader.What changes are included in this PR?
Return an empty buffer instead of reopening. Callers already treat that as end of stream; the trait's own
read_alldoes (core/core/src/raw/oio/read/api.rs:119).This covers bounded ranges and suffixes. An unbounded read has no size to compare against, so it still reopens past the end. Catching that needs the object size.
Adds a test that fails without the guard.
test_retry_readreads unbounded, so it still reopens and still expects five attempts. It is unchanged.Are there any user-facing changes?
Don't think so
Breaking changes
No
AI Usage Statement