Skip to content

fix: don't signal onComplete when a chunk is fully consumed by the ra… - #523

Open
sharmabikram wants to merge 1 commit into
mainfrom
shbikram/adjustedrange-premature-oncomplete
Open

sharmabikram wants to merge 1 commit into
mainfrom
shbikram/adjustedrange-premature-oncomplete

Conversation

@sharmabikram

Copy link
Copy Markdown
Contributor

Consume the chunk toward the skip and return instead of completing; the real onComplete still fires when upstream ends. Changed > to >= so a chunk equal to the skip is also fully consumed. Fixes #517.

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Check any applicable:

  • Were any files moved? Moving files changes their URL, which breaks all hyperlinks to the files.

@sharmabikram
sharmabikram requested a review from a team as a code owner September 24, 2026 21:02
// rather than signaling completion.
numBytesToSkip -= buf.length;
wrappedSubscriber.onComplete();
return;

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.

I am pretty sure we still need to signal something to the subscriber. I don't know what it would be but it feels really weird that we would go from telling the subscriber "done" to not telling the subscriber anything.

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.

Maybe signal wrappedSubscriber's onNext with an empty buffer? Since that's really what's going on here

…nge skip

AdjustedRangeSubscriber called onComplete (and fell through to an NPE) when
numBytesToSkip exceeded a chunk, so a small first chunk ended ranged GETs
with an empty stream. Consume the chunk toward the skip and wait for the
next one instead. Fixes #517.
@sharmabikram
sharmabikram force-pushed the shbikram/adjustedrange-premature-oncomplete branch from f9fb658 to 4bb8003 Compare September 26, 2026 23:03

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ranged GET can return an empty stream: AdjustedRangeSubscriber prematurely signals onComplete when the first chunk is smaller than the pending skip

2 participants