Hi Akka gurus,
1. We use Akka in a production setup
2. We use Cassandra as a back up for akka-persistence.
3. One of the PersistentActors throwed NullPointerException during
startup.
*The Akka libraries used :*
"com.typesafe.akka" %% "akka-actor" % "2.4.17",
"com.typesafe.akka" %% "akka-slf4j" % "2.4.17",
"com.typesafe.akka" %% "akka-remote" % "2.4.17",
"com.typesafe.akka" %% "akka-cluster" % "2.4.17",
"com.typesafe.akka" %% "akka-cluster-sharding" % "2.4.17",
"com.typesafe.akka" %% "akka-persistence" % v,
"com.typesafe.akka" %% "akka-persistence-cassandra" % "0.23",
"com.typesafe.akka" %% "akka-http-core" % "10.0.1",
"com.typesafe.akka" %% "akka-stream" % "2.4.17",
"com.typesafe.akka" %% "akka-cluster-tools" % "2.4.17"
*The receive recover method of my Actor is as follows.*
override def receiveRecover: Receive = {
case SnapshotOffer(_, snapshot: DeviceActorReset) =>
isProcessing = false
task = null
context.become(receiveIdleCommand())
case TaskParsed(parsedTask) =>
isProcessing = true
task = parsedTask
context.become(receiveValidateCommand())
case TaskValidated => context.become(receiveProcessCommand)
case RecoveryCompleted => {
logger.debug(s"Recovery completed successfully for device actor :
${self.path.name}")
self ! Continue
}
}
When one of the PersistentActors is started, we got
java.lang.NullPointerException
*The logs are as follows*
DEBUG [com.sam.sami.argus.tasks.PersistentDeviceActor]
(argus-akka.actor.default-dispatcher-5) 5643266d56c44415bc65ab7301ef938a
Starting a deviceActor
ERROR [akka.actor.OneForOneStrategy] (argus-akka.actor.default-dispatcher-16)
null
-java.lang.NullPointerException: null
: at
com.sam.sami.argus.tasks.PersistentDeviceActor$$anonfun$receiveProcessCommand$1.applyOrElse(PersistentDeviceActor.scala:183)
- at akka.actor.Actor$class.aroundReceive(Actor.scala:497)
- at
com.sam.sami.argus.tasks.PersistentDeviceActor.akka$persistence$Eventsourced$$super$aroundReceive(PersistentDeviceActor.scala:29)
- at
akka.persistence.Eventsourced$$anon$1.stateReceive(Eventsourced.scala:664)
- at
akka.persistence.Eventsourced$class.aroundReceive(Eventsourced.scala:183)
- at
com.sam.sami.argus.tasks.PersistentDeviceActor.aroundReceive(PersistentDeviceActor.scala:29)
- at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526)
- at akka.actor.ActorCell.invoke(ActorCell.scala:495)
- at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)
- at akka.dispatch.Mailbox.run(Mailbox.scala:224)
- at akka.dispatch.Mailbox.exec(Mailbox.scala:234)
- 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)
DEBUG [com.sam.sami.argus.tasks.PersistentDeviceActor]
(argus-akka.actor.default-dispatcher-16) Snapshot recovery :
DeviceActorReset(5643266d56c44415bc65ab7301ef938a)
DEBUG [com.sam.sami.argus.tasks.PersistentDeviceActor]
(argus-akka.actor.default-dispatcher-5) Recovery completed successfully for
device actor : 5643266d56c44415bc65ab7301ef938a
*Actor behavior or States*
We have the following different behavior aka states for this. (I want to
mention this because the state names are occurring in the above logs)
- receiveIdleCommand
- receiveValidateCommand
- receiveProcessCommand
5643266d56c44415bc65ab7301ef938a is just an ID we use to create actor names.
I am trying to understand what caused this.
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.