Hi,
I write scala script to read some thousands of event stream and do something with it.
Code looks like :
List(some stream uid …).map { uid =>
val events: Future[List[Event]] = connection.future(ReadStreamEvents(uid)).map { ‘some json parsing to have at the end List[Event]’ }
doSomethingWithEvents(events)
}
``
When I try this kind of things with more than thousand uids, I have some error :
Uncaught error from thread [my-eventstore-akka.actor.default-dispatcher-2] shutting down JVM since ‘akka.jvm-exit-on-fatal-error’ is enabled for ActorSystem[my-eventstore]
java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Thread.java:714)
at scala.concurrent.forkjoin.ForkJoinPool.tryAddWorker(ForkJoinPool.java:1672)
at scala.concurrent.forkjoin.ForkJoinPool.signalWork(ForkJoinPool.java:1966)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.push(ForkJoinPool.java:1072)
at scala.concurrent.forkjoin.ForkJoinTask.fork(ForkJoinTask.java:654)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinPool.execute(AbstractDispatcher.scala:386)
at akka.dispatch.ExecutorServiceDelegate$class.execute(ThreadPoolBuilder.scala:212)
at akka.dispatch.Dispatcher$LazyExecutorServiceDelegate.execute(Dispatcher.scala:43)
at akka.dispatch.Dispatcher.registerForExecution(Dispatcher.scala:118)
at akka.dispatch.MessageDispatcher.attach(AbstractDispatcher.scala:133)
at akka.actor.dungeon.Dispatch$class.start(Dispatch.scala:87)
at akka.actor.ActorCell.start(ActorCell.scala:369)
at akka.actor.LocalActorRef.start(ActorRef.scala:321)
at akka.actor.dungeon.Children$class.makeChild(Children.scala:220)
at akka.actor.dungeon.Children$class.actorOf(Children.scala:35)
at akka.actor.ActorCell.actorOf(ActorCell.scala:369)
at eventstore.tcp.ConnectionActor.newPipeline(ConnectionActor.scala:395)
at eventstore.tcp.ConnectionActor$$anonfun$rcvConnected$1.applyOrElse(ConnectionActor.scala:315)
at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:170)
at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:171)
at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:171)
at akka.actor.Actor$class.aroundReceive(Actor.scala:465)
at eventstore.tcp.ConnectionActor.aroundReceive(ConnectionActor.scala:30)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516)
at akka.actor.ActorCell.invoke(ActorCell.scala:487)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:254)
at akka.dispatch.Mailbox.run(Mailbox.scala:221)
at akka.dispatch.Mailbox.exec(Mailbox.scala:231)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
``
Any idea of what is the problem ?
Thx for your answer.