# gRPC Stream Cancellation, under what conditions?

**URL:** https://discuss.akka.io/t/grpc-stream-cancellation-under-what-conditions/9853
**Category:** Akka gRPC
**Tags:** scala, streams
**Created:** [June 29, 2022, 4:52pm UTC](https://discuss.akka.io/t/grpc-stream-cancellation-under-what-conditions/9853 "2022-06-29T16:52:30Z")
**Posts on this page:** 1
**Showing post:** 8

<div class="post-metadata">

### Author: ![MouthySpider](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/mouthyspider/32/2844_2.png) [@MouthySpider](https://discuss.akka.io/u/MouthySpider)
#### Post date: [July 21, 2022, 4:15pm UTC](https://discuss.akka.io/t/grpc-stream-cancellation-under-what-conditions/9853/8 "2022-07-21T16:15:46Z")

</div>

Actually this seems to solve the issue. I am still using the `MergeHub` here but I am no longer getting the “MergeHub shutting down” errors either.

```auto
    (in.watchTermination() {
      case (_, terminationFuture) =>
        terminationFuture.map(_ => Received())
    })
      .toMat(sink)(Keep.left)
      .run()

```

Thank you for pointing that out, we’ve been stumped by this issue for several months! (yes, since last year). The lesson learned here is that sending a gRPC reply right away effectively shuts down the stream before the `MergeHub` can drain it.

---

_[View the full topic](https://discuss.akka.io/t/grpc-stream-cancellation-under-what-conditions/9853)._
