sadekmunawar commented on PR #1385: URL: https://github.com/apache/pekko/pull/1385#issuecomment-2210879087
> The test code was written by https://discuss.lightbend.com/u/nodeninja/summary > > @sadekmunawar can you confirm if that is you? We received your iCLA. > @pjfanning yes, that's me. After finding the bug, I wrote that test for a solution I implemented. My solution converts the `FatallyFailed` into a case class and attaches an Optional ActorRef to it. I also wrote a scala version of this test in `ActorLifCyleSpec`. Feel free to use either version of the test `"must not break supervisor strategy due to unhandled exception in preStart" in { val id = newUuid.toString val gen = new AtomicInteger(0) val maxRetryNum = 3 val childProps = Props(new LifeCycleTestActor(testActor, id, gen) { override def preStart(): Unit = { report("preStart") throw new Exception("test exception") } }).withDeploy(Deploy.local) val supervisorStrategy: SupervisorStrategy = OneForOneStrategy(maxNrOfRetries = maxRetryNum, timeout.duration) { case _: ActorInitializationException => SupervisorStrategy.Restart case _ => SupervisorStrategy.Escalate } val supervisor = system.actorOf(Props(classOf[Supervisor], supervisorStrategy)) Await.result((supervisor ? childProps).mapTo[ActorRef], timeout.duration) (0 to maxRetryNum).foreach(i => { expectMsg(("preStart", id, i)) }) expectNoMessage() system.stop(supervisor) }` -- 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]
