Skip to content

Akka-FSM stateTimeout ignores forMax Duration.Inf #17140

@folex

Description

@folex

Code to reproduce:

sealed trait State
import scala.concurrent.duration._
import akka.actor._

sealed trait Data
case object Initial extends State
case object Waiting extends State
case object Empty extends Data

class FSMActor extends LoggingFSM[State, Data] {
      startWith(Initial, Empty)

      when(Initial) {
        case Event("Wait", _) => goto(Waiting)
      }

      when(Waiting, stateTimeout = 5.seconds) {
        case Event("Message", _) => 
          println(self.path.name + " got message")
          stay() forMax (Duration.Inf)

        case Event(StateTimeout, _) => 
          println(self.path.name + " got StateTimeout :(")
          stay()
      }
}

val system = ActorSystem("system")
val fsm = system.actorOf(Props(new FSMActor), "fsm")
fsm ! "Wait"
fsm ! "Message"

Actor shouldn't receive StateTimeout message since stay() was called with forMax(Duration.Inf).

Version is 2.4-SNAPSHOT, bug appeared after update on Apr 02.

Related thread on akka-user: https://groups.google.com/forum/#!topic/akka-user/NsAoqPZ2Svo

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions