{"action":"opened","issue":{"url":"https://api.github.com/repos/akka/akka/issues/25802","repository_url":"https://api.github.com/repos/akka/akka","labels_url":"https://api.github.com/repos/akka/akka/issues/25802/labels{/name}","comments_url":"https://api.github.com/repos/akka/akka/issues/25802/comments","events_url":"https://api.github.com/repos/akka/akka/issues/25802/events","html_url":"https://github.com/akka/akka/issues/25802","id":370673843,"node_id":"MDU6SXNzdWUzNzA2NzM4NDM=","number":25802,"title":"Akka typed: No Terminated signal from child if parent is restarted","user":{"login":"michkhol","id":10834765,"node_id":"MDQ6VXNlcjEwODM0NzY1","avatar_url":"https://avatars3.githubusercontent.com/u/10834765?v=4","gravatar_id":"","url":"https://api.github.com/users/michkhol","html_url":"https://github.com/michkhol","followers_url":"https://api.github.com/users/michkhol/followers","following_url":"https://api.github.com/users/michkhol/following{/other_user}","gists_url":"https://api.github.com/users/michkhol/gists{/gist_id}","starred_url":"https://api.github.com/users/michkhol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michkhol/subscriptions","organizations_url":"https://api.github.com/users/michkhol/orgs","repos_url":"https://api.github.com/users/michkhol/repos","events_url":"https://api.github.com/users/michkhol/events{/privacy}","received_events_url":"https://api.github.com/users/michkhol/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-16T15:36:34Z","updated_at":"2018-10-16T15:36:34Z","closed_at":null,"author_association":"NONE","body":"I do not see the Terminated signal if I stop children manually before the parent is restarted. Since the https://github.com/akka/akka/issues/25556 is not yet fixed, I need to make sure all children are stopped before I can re-use the name(s). But if the Terminated signal is not sent/propagated, I cannot do that.\r\n```\r\nimport akka.actor.ActorSystem\r\nimport akka.actor.typed.{ActorRef, Behavior, PostStop, PreRestart, SupervisorStrategy, Terminated}\r\nimport akka.actor.typed.scaladsl.Behaviors\r\n\r\nimport scala.concurrent.duration._\r\nimport akka.actor.typed.scaladsl.adapter._\r\n\r\nobject RestartTerminatedBug {\r\n\r\n  trait Msg\r\n\r\n  implicit val actorSystem = ActorSystem(\"actorsystem\")\r\n  implicit val ec = actorSystem.dispatcher\r\n\r\n  val start: Behavior[Msg] = Behaviors.setup { ctx =>\r\n    val supervised: Behavior[Msg] = Behaviors.supervise(BadActor.start)\r\n      .onFailure[IndexOutOfBoundsException](SupervisorStrategy.restartWithBackoff(5.seconds, 30.seconds, 0))\r\n    val badActor = ctx.spawn(supervised, \"badActor\")\r\n    ctx.watch(badActor)\r\n    active\r\n  }\r\n\r\n  val active: Behavior[Msg] = Behaviors.receive[Msg] { (ctx, msg) =>\r\n    Behaviors.same\r\n  }.receiveSignal {\r\n    case (_, Terminated(w)) =>\r\n      Behaviors.stopped\r\n    case (_, PostStop) =>\r\n      System.err.println(\"System has been terminated.\")\r\n      actorSystem.terminate().foreach(_ => System.exit(1))\r\n      Behaviors.same\r\n  }\r\n\r\n  def main(args: Array[String]): Unit = {\r\n    actorSystem.spawn(RestartTerminatedBug.start, \"supevisor\")\r\n  }\r\n\r\n\r\n  object BadActor {\r\n\r\n    case object TestMsg extends Msg\r\n\r\n    val start: Behavior[Msg] = Behaviors.setup { ctx =>\r\n      val child = ctx.spawn(PoorChild.active, \"poorchild\")\r\n      ctx.watch(child)\r\n      ctx.self ! TestMsg\r\n      active(child)\r\n    }\r\n\r\n    def active(childRef: ActorRef[Msg]): Behavior[Msg] = Behaviors.receive[Msg] { (ctx, msg) =>\r\n      ctx.stop(childRef)\r\n      throw new IndexOutOfBoundsException(\"Test exception\")\r\n    }.receiveSignal {\r\n      case (_, Terminated(a)) =>\r\n        System.err.println(\"Actor terminated: \" + a) // Never printed\r\n        Behaviors.same\r\n      case (ctx, PreRestart) =>\r\n        System.err.println(\"BadActor is being restarted.\")\r\n        Behaviors.same\r\n    }\r\n  }\r\n\r\n  object PoorChild {\r\n\r\n    val active: Behavior[Msg] = Behaviors.receive[Msg] { (ctx, msg) =>\r\n      Behaviors.same\r\n    }\r\n  }\r\n\r\n}\r\n```"}}
{"actor":{"display_login":"michkhol"}}