Skip to content

fix: terminate unavailable input stream publishers once - #13

Closed
Vikram-Lex wants to merge 1 commit into
lqhuang:mainfrom
Vikram-Lex:codex/http-body-contract
Closed

fix: terminate unavailable input stream publishers once#13
Vikram-Lex wants to merge 1 commit into
lqhuang:mainfrom
Vikram-Lex:codex/http-body-contract

Conversation

@Vikram-Lex

Copy link
Copy Markdown

When BodyPublishers.ofInputStream receives a supplier that returns null, it subscribes to an empty publisher before reporting IOException. Positive demand can therefore produce both completion and failure; invalid demand can produce two errors, and cancellation during onSubscribe is ignored.

Use a failed subscription with one atomic terminal state so cancellation, invalid demand, and the unavailable-stream error cannot produce conflicting callbacks. Add four public-API regression cases shared with the JVM tests. They record callbacks and check them from the test thread, which catches extra terminal signals that assertions inside worker callbacks can miss.

Validation on macOS arm64 (Scala 3.3.7 / Scala Native 0.5.12 / JVM 25):

  • All four new cases pass on Java 25 and fail against unchanged Native source at 42ac91b4.
  • With the fix, all 44 publisher checks pass on Native; the same 44 checks pass on JVM 25.
  • Cases cover immediate demand, demand after failure, cancellation during subscription, and invalid demand.

This contributes to the JVM-parity work discussed in Requests-Scala #156. Would a US$25 reward be available for this fix and its tests?

@lqhuang

lqhuang commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Close since it seems agent spam. Reopen only if you're not a bot.

@lqhuang lqhuang closed this Sep 8, 2026
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.

2 participants