# Handling KillSwitch in Akka Streams

**URL:** <https://discuss.akka.io/t/handling-killswitch-in-akka-streams/718>\
**Category:** Akka Streams & Alpakka\
**Created:** [April 16, 2018, 6:17am UTC](https://discuss.akka.io/t/handling-killswitch-in-akka-streams/718 "2018-04-16T06:17:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![idoshamun](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/idoshamun/32/409_2.png) [@idoshamun](https://discuss.akka.io/u/idoshamun)\
**Post date:** [April 16, 2018, 6:17am UTC](https://discuss.akka.io/t/handling-killswitch-in-akka-streams/718/1 "2018-04-16T06:17:55Z")

</div>

I am initializing a stream inside an actor and killing this stream using `KillSwitch` when the actor stops.  
I would like to close existing connections in my custom source of the stream when shutting down the stream but the `postStop` method is not called, am I missing something?

---

<div class="post-metadata">

**Author:** ![johanandren](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/johanandren/32/85_2.png) [@johanandren](https://discuss.akka.io/u/johanandren)\
**Post date:** [April 16, 2018, 8:34am UTC](https://discuss.akka.io/t/handling-killswitch-in-akka-streams/718/2 "2018-04-16T08:34:51Z")

</div>

`postStop` should always be called when the stream is shut down, regardless if it is graceful or an “abrupt termination” (shutting down the materialiser or actor system) so this sounds very weird.

Do you have a minimal reproducer you can share?

---

<div class="post-metadata">

**Author:** ![idoshamun](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/idoshamun/32/409_2.png) [@idoshamun](https://discuss.akka.io/u/idoshamun)\
**Post date:** [April 16, 2018, 8:36am UTC](https://discuss.akka.io/t/handling-killswitch-in-akka-streams/718/3 "2018-04-16T08:36:41Z")

</div>

I will try making one, but today it seems like working.  
I’ll try giving it a deeper look
