fix: propagate file body subscriber I/O failures - #14
Closed
Wfontesd wants to merge 1 commit into
Closed
Conversation
Cancel the upstream subscription when opening the destination fails. Catch write failures and use the existing error handler to close the channel and complete the response body exceptionally. Add regression tests for a missing parent directory and a failed write, plus a successful multi-buffer output case. All three pass on JDK 25; the two error cases fail on Native before the fix. The updated Native subscriber and handler suites pass all 160 tests.
Owner
|
Close since it seems agent spam. Reopen only if you're not a bot. |
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
BodySubscribers.ofFilecannot open the destination, the body future fails but the upstream subscription remains active. If opening succeeds and a later write fails, the exception escapesonNextinstead of reaching the body future.This change cancels the subscription in both cases and sends the exception through the existing error handler, which closes the file channel and completes the body future exceptionally. Successful writes keep the same behavior.
The regression tests cover a missing parent directory and a write to Linux
/dev/full, which reliably reports that the device has no space. A third test checks successful output across multiple buffers, including an empty buffer.Validation:
git diff --cached --checkpasses.The
/dev/fullcase runs only where that device exists. Validation was performed on Linux with Scala Native 0.5.12; no Windows or macOS Native run is claimed.Fixed with the help of AI.
Would you consider US$35 via PayPal for accepting this focused fix? This replaces my earlier US$100 proposal in requests-scala#156. It is a proposed price, not an agreed award. Payment details can be shared privately.