Skip to content

Share streaming cancellation tests across backends, fix backends that fail them - #3056

Merged
adamw merged 6 commits into
masterfrom
streaming-cancellation-tests
Nov 3, 2026
Merged

adamw merged 6 commits into
masterfrom
streaming-cancellation-tests

Conversation

@adamw

@adamw adamw commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #3054. The cancellation tests from that PR now live in StreamingTest, so every streaming backend runs them, on all platforms. Pekko and Akka skip them, since a Future can't be cancelled. The zio1 HttpClient and Armeria backends skip them too.

Backends that failed, and the fixes:

  • HttpClient zio, Armeria zio: zio-interop's publisher doesn't stop a stream that waits for data when the subscription is cancelled. Added InterruptibleStreamPublisher, which interrupts it.
  • Armeria fs2: the response body had the same bug as Remove fs2 interop with reactive-streams #2963. It now uses fs2's Flow interop for both request and response bodies, so the fs2-reactive-streams dependency is removed.
  • http4s (CE3, CE2): blaze keeps running the request body stream after the request is cancelled, so streamed bodies are now interrupted on cancel. On CE2, cancelling send also didn't cancel the request at all; fixed.
  • Fetch fs2 (JS): reading a response body couldn't be cancelled while waiting for data. Reads now cancel the reader.
  • OkHttp monix: the request body stream was never cancelled. OkHttpAsyncBackend now cancels bodies that implement CancellableRequestBody.

Known gaps: on OkHttp, multipart bodies with streamed parts aren't cancelled.

🤖 Generated with Claude Code

adamw added 6 commits November 3, 2026 07:54
… fail them

Moves the cancellation tests added in #3054 to StreamingTest, so all streaming backends run them, and fixes the backends that didn't cancel properly:

- HttpClient zio/zio1, Armeria zio: interrupt the request body stream when its subscription is cancelled
- Armeria fs2: use fs2's Flow interop for the response body (same bug as #2963)
- http4s (CE3 and CE2): interrupt streamed request bodies on cancel; CE2 now also cancels the request fiber
- OkHttp monix: cancel the request body stream when the request is cancelled
…ion-tests

# Conflicts:
#	core/src/test/scalanative/sttp/client4/testing/streaming/StreamingTestExtensions.scala
@adamw
adamw merged commit 4886d7c into master Nov 3, 2026
27 checks passed
@adamw
adamw deleted the streaming-cancellation-tests branch November 3, 2026 10:24
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.

1 participant