pjfanning opened a new pull request, #921:
URL: https://github.com/apache/pekko-grpc/pull/921
### Motivation
With the pekko-http client backend, cancelling a server streaming call (e.g.
`client.itKeepsReplying(req).runWith(Sink.head)`) never reached the server.
`responseToSource` always added `CancellationBarrierGraphStage`, which keeps
reading the response so the trailers can be read. As a result the server stream
kept running and was never stopped.
### Modification
Port of akka/akka-grpc#1832 (Akka gRPC 2.4.0, Apache 2.0 since its change
date, 2026-10-24):
- `PekkoHttpClientUtils.responseToSource` takes a `streamingResponse` flag
(default `false`) and adds the cancellation barrier only for single responses.
- The pekko-http `InternalChannel` passes the flag it already gets for each
call.
Unlike upstream, the flag goes after the existing `maxInboundMessageSize`
parameter and has a default, so existing callers don't change.
`responseToSource` is `@InternalApi`, and the existing 2.0.x MiMa exclude
already covers it.
`interop-tests/.../PekkoHttpClientCancelSpec.scala` is copied from
upstream's `plugin-tester-scala/.../AkkaHttpClientCancelSpec.scala`. It keeps
the original Lightbend copyright line, with the ASF "derived from Akka" header
above it as in neighbouring files. It is adapted to Pekko as follows:
- It lives in `interop-tests`, so it runs in the sbt build.
- It uses the classic `TestKit`/`TestProbe`.
- It calls `watchTermination` without the empty parameter list, which is
Pekko's signature.
- It selects the backend with `withBackend("pekko-http")`.
### Result
Cancelling a server streaming call with the pekko-http backend now stops the
stream on the server.
### Tests
- New `PekkoHttpClientCancelSpec`: fails without the fix (the server stream
did not complete within 5 seconds), passes with it
- `sbt runtime/test`: 189 passed
- `sbt interop-tests/test`: 255 passed
- `sbt runtime/mimaReportBinaryIssues`: passed
- `scalafmt --mode diff-ref=upstream/main` run
- `sbt interop-tests/Test/headerCheck`: passed
### References
Refs akka/akka-grpc#1832
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]