ktoso / akka-raft

A toy project implementing RAFT on top of Akka Cluster (not prod ready)
http://blog.project13.pl
Apache License 2.0
280 stars 42 forks source link

Crash: "Unable to find log entry at index 2" #48

Open colin-scott opened 9 years ago

colin-scott commented 9 years ago

I found the following stacktrace while fuzz testing akka-raft. Unfortunately I do not have a reproducible test case for this one:

[ERROR] [03/12/2015 15:04:50.367] [new-system-0-akka.actor.default-dispatcher-12] [akka://new-system-0/user/raft-member-3] Unable to find log entry at index 2
java.lang.RuntimeException: Unable to find log entry at index 2
        at pl.project13.scala.akka.raft.model.ReplicatedLog$$anonfun$termAt$2.apply(ReplicatedLog.scala:107)
        at pl.project13.scala.akka.raft.model.ReplicatedLog$$anonfun$termAt$2.apply(ReplicatedLog.scala:107)
        at scala.Option.getOrElse(Option.scala:120)
        at pl.project13.scala.akka.raft.model.ReplicatedLog.termAt(ReplicatedLog.scala:107)
        at pl.project13.scala.akka.raft.protocol.RaftProtocol$AppendEntries$.apply(RaftProtocol.scala:49)
        at pl.project13.scala.akka.raft.Leader$$anonfun$replicateLog$1.apply(Leader.scala:118)
        at pl.project13.scala.akka.raft.Leader$$anonfun$replicateLog$1.apply(Leader.scala:114)
        at scala.collection.immutable.HashSet$HashSet1.foreach(HashSet.scala:322)
        at scala.collection.immutable.HashSet$HashTrieSet.foreach(HashSet.scala:978)
        at pl.project13.scala.akka.raft.Leader$class.replicateLog(Leader.scala:114)
        at pl.project13.scala.akka.raft.RaftActor.replicateLog(RaftActor.scala:13)
        at pl.project13.scala.akka.raft.Leader$$anonfun$1.applyOrElse(Leader.scala:43)
        at pl.project13.scala.akka.raft.Leader$$anonfun$1.applyOrElse(Leader.scala:16)
        at scala.PartialFunction$OrElse.apply(PartialFunction.scala:162)
        at akka.actor.FSM$class.processEvent(FSM.scala:604)
        at pl.project13.scala.akka.raft.RaftActor.akka$actor$LoggingFSM$$super$processEvent(RaftActor.scala:13)
        at akka.actor.LoggingFSM$class.processEvent(FSM.scala:734)
        at pl.project13.scala.akka.raft.RaftActor.processEvent(RaftActor.scala:13)
        at akka.actor.FSM$class.akka$actor$FSM$$processMsg(FSM.scala:598)
        at akka.actor.FSM$$anonfun$receive$1.applyOrElse(FSM.scala:592)
        at akka.actor.Actor$class.aroundReceive(Actor.scala:465)
        at pl.project13.scala.akka.raft.RaftActor.aroundReceive(RaftActor.scala:13)
        at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516)
        at akka.actor.ActorCell.invoke(ActorCell.scala:487)
        at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:238)
        at akka.dispatch.Mailbox.run(Mailbox.scala:220)
        at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)
        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)
colin-scott commented 9 years ago

A likely fix for this issue here [non-pull-request-worthy]:

NetSys/sts2-applications@1840499