{"action":"created","issue":{"url":"https://api.github.com/repos/akka/akka/issues/23642","repository_url":"https://api.github.com/repos/akka/akka","labels_url":"https://api.github.com/repos/akka/akka/issues/23642/labels{/name}","comments_url":"https://api.github.com/repos/akka/akka/issues/23642/comments","events_url":"https://api.github.com/repos/akka/akka/issues/23642/events","html_url":"https://github.com/akka/akka/issues/23642","id":257968721,"number":23642,"title":"Issue with RestartSink.withBackoff and akka-streams-kafka","user":{"login":"juanjoDiaz","id":3322485,"avatar_url":"https://avatars0.githubusercontent.com/u/3322485?v=4","gravatar_id":"","url":"https://api.github.com/users/juanjoDiaz","html_url":"https://github.com/juanjoDiaz","followers_url":"https://api.github.com/users/juanjoDiaz/followers","following_url":"https://api.github.com/users/juanjoDiaz/following{/other_user}","gists_url":"https://api.github.com/users/juanjoDiaz/gists{/gist_id}","starred_url":"https://api.github.com/users/juanjoDiaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juanjoDiaz/subscriptions","organizations_url":"https://api.github.com/users/juanjoDiaz/orgs","repos_url":"https://api.github.com/users/juanjoDiaz/repos","events_url":"https://api.github.com/users/juanjoDiaz/events{/privacy}","received_events_url":"https://api.github.com/users/juanjoDiaz/received_events","type":"User","site_admin":false},"labels":[{"id":92667537,"url":"https://api.github.com/repos/akka/akka/labels/0%20-%20new","name":"0 - new","color":"ffffff","default":false},{"id":93144690,"url":"https://api.github.com/repos/akka/akka/labels/t:stream","name":"t:stream","color":"cccccc","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-09-15T08:47:52Z","updated_at":"2017-09-18T12:23:53Z","closed_at":null,"author_association":"NONE","body":"I have a very simple producer:\r\n```\r\n    Source(1 to 8)\r\n      .map(new ProducerRecord[Array[Byte], Int](topic, _))\r\n      .runWith(\r\n        RestartSink.withBackoff(3 seconds, 30 seconds, 0.2) { () => Producer.plainSink(producerSettings)}\r\n      )\r\n```\r\n\r\nIt work flawlessly when I run it as an app. However, if I run the exact same code within a test I get `java.lang.IllegalStateException: cannot create children while terminating or terminated`\r\n\r\nIt's interesting that when I run it without the Retry logic it seems to work perfectly.\r\n```\r\n    Source(1 to 8)\r\n      .map(new ProducerRecord[Array[Byte], Int](topic, _))\r\n      .runWith(\r\n        Producer.plainSink(producerSettings)\r\n      )\r\n```\r\n\r\nHere is the full error\r\n```\r\nError during preStart in [akka.stream.scaladsl.RestartWithBackoffSink@747cf70e]: cannot create children while terminating or terminated\r\njava.lang.IllegalStateException: cannot create children while terminating or terminated\r\n\tat akka.actor.dungeon.Children.makeChild(Children.scala:270)\r\n\tat akka.actor.dungeon.Children.attachChild(Children.scala:48)\r\n\tat akka.actor.dungeon.Children.attachChild$(Children.scala:47)\r\n\tat akka.actor.ActorCell.attachChild(ActorCell.scala:370)\r\n\tat akka.stream.impl.ExtendedActorMaterializer.actorOf(ActorMaterializerImpl.scala:60)\r\n\tat akka.stream.impl.GraphStageIsland.onIslandReady(PhasedFusingActorMaterializer.scala:742)\r\n\tat akka.stream.impl.IslandTracking.allNestedIslandsReady(PhasedFusingActorMaterializer.scala:330)\r\n\tat akka.stream.impl.PhasedFusingActorMaterializer.materialize(PhasedFusingActorMaterializer.scala:508)\r\n\tat akka.stream.impl.SubFusingActorMaterializerImpl.materialize(ActorMaterializerImpl.scala:112)\r\n\tat akka.stream.impl.SubFusingActorMaterializerImpl.materialize(ActorMaterializerImpl.scala:101)\r\n\tat akka.stream.scaladsl.RunnableGraph.run(Flow.scala:496)\r\n\tat akka.stream.scaladsl.Source.runWith(Source.scala:83)\r\n\tat akka.stream.scaladsl.RestartWithBackoffSink$$anon$2.startGraph(Restart.scala:136)\r\n\tat akka.stream.scaladsl.RestartWithBackoffLogic.preStart(Restart.scala:353)\r\n\tat akka.stream.impl.fusing.GraphInterpreter.init(GraphInterpreter.scala:290)\r\n\tat akka.stream.impl.fusing.GraphInterpreterShell.init(ActorGraphInterpreter.scala:540)\r\n\tat akka.stream.impl.fusing.ActorGraphInterpreter.tryInit(ActorGraphInterpreter.scala:659)\r\n\tat akka.stream.impl.fusing.ActorGraphInterpreter.preStart(ActorGraphInterpreter.scala:707)\r\n\tat akka.actor.Actor.aroundPreStart(Actor.scala:522)\r\n\tat akka.actor.Actor.aroundPreStart$(Actor.scala:522)\r\n\tat akka.stream.impl.fusing.ActorGraphInterpreter.aroundPreStart(ActorGraphInterpreter.scala:650)\r\n\tat akka.actor.ActorCell.create(ActorCell.scala:591)\r\n\tat akka.actor.ActorCell.invokeAll$1(ActorCell.scala:462)\r\n\tat akka.actor.ActorCell.systemInvoke(ActorCell.scala:484)\r\n\tat akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:282)\r\n\tat akka.dispatch.Mailbox.run(Mailbox.scala:223)\r\n\tat akka.dispatch.Mailbox.exec(Mailbox.scala:234)\r\n\tat akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)\r\n\tat akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)\r\n\tat akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)\r\n\tat akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)\r\n\r\n```\r\n\r\nAny help is more than welcome!"},"comment":{"url":"https://api.github.com/repos/akka/akka/issues/comments/330203474","html_url":"https://github.com/akka/akka/issues/23642#issuecomment-330203474","issue_url":"https://api.github.com/repos/akka/akka/issues/23642","id":330203474,"user":{"login":"juanjoDiaz","id":3322485,"avatar_url":"https://avatars0.githubusercontent.com/u/3322485?v=4","gravatar_id":"","url":"https://api.github.com/users/juanjoDiaz","html_url":"https://github.com/juanjoDiaz","followers_url":"https://api.github.com/users/juanjoDiaz/followers","following_url":"https://api.github.com/users/juanjoDiaz/following{/other_user}","gists_url":"https://api.github.com/users/juanjoDiaz/gists{/gist_id}","starred_url":"https://api.github.com/users/juanjoDiaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juanjoDiaz/subscriptions","organizations_url":"https://api.github.com/users/juanjoDiaz/orgs","repos_url":"https://api.github.com/users/juanjoDiaz/repos","events_url":"https://api.github.com/users/juanjoDiaz/events{/privacy}","received_events_url":"https://api.github.com/users/juanjoDiaz/received_events","type":"User","site_admin":false},"created_at":"2017-09-18T12:23:53Z","updated_at":"2017-09-18T12:23:53Z","author_association":"NONE","body":"Just to add some more info the issue has vanished from my code.\r\n\r\nI use [docker-it-scala](https://github.com/whisklabs/docker-it-scala) to spin up [Kafka](https://hub.docker.com/r/spotify/kafka/) for my test and all I've changed is the Timeout for accessing Kafka. Also, I've given some more memory to the tests. So I think that the issue has to do with timing maybe?\r\n\r\nIn any case, the fact that it worked without `Restart.withBackoff` points to it as the root cause of the actor system shutting down andI would expect that `Restart.withBackoff` doesn't shut down the actor system."}}
{"actor":{"display_login":"juanjoDiaz"}}