Skip to content

Commit

Permalink
fix memory queue stuck in removed state edge case (#5388)
Browse files Browse the repository at this point in the history
Co-authored-by: Brendan Doyle <brendand@qualtrics.com>
  • Loading branch information
bdoyle0182 and Brendan Doyle committed Apr 3, 2023
1 parent 7c94e9b commit fedf022
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,9 @@ class MemoryQueue(private val etcdClient: EtcdClient,

// This is not supposed to happen. This will ensure the queue does not run forever.
// This can happen when QueueManager could not respond with QueueRemovedCompleted for some reason.
// Note: Activation messages can be received while waiting to timeout which resets the state timeout.
// Therefore the state timeout must be set externally on transition to prevent the queue stuck waiting
// to remove forever cycling activations between the manager and this fsm.
case Event(StateTimeout, _: NoData) =>
context.parent ! queueRemovedMsg

Expand Down Expand Up @@ -677,6 +680,8 @@ class MemoryQueue(private val etcdClient: EtcdClient,
case Uninitialized -> _ => unstashAll()
case _ -> Flushing => startTimerWithFixedDelay("StopQueue", StateTimeout, queueConfig.flushGrace)
case Flushing -> _ => cancelTimer("StopQueue")
case _ -> Removed => startTimerWithFixedDelay("RemovedQueue", StateTimeout, queueConfig.stopGrace)
case Removed -> _ => cancelTimer("RemovedQueue") //Removed state is a sink so shouldn't be able to hit this.
}

onTermination {
Expand Down

0 comments on commit fedf022

Please sign in to comment.