Skip to content

Commit fedf022

Browse files
bdoyle0182Brendan Doyle
andauthored
fix memory queue stuck in removed state edge case (#5388)
Co-authored-by: Brendan Doyle <[email protected]>
1 parent 7c94e9b commit fedf022

File tree

1 file changed

+5
-0
lines changed
  • core/scheduler/src/main/scala/org/apache/openwhisk/core/scheduler/queue

1 file changed

+5
-0
lines changed

core/scheduler/src/main/scala/org/apache/openwhisk/core/scheduler/queue/MemoryQueue.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,9 @@ class MemoryQueue(private val etcdClient: EtcdClient,
456456

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

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

682687
onTermination {

0 commit comments

Comments
 (0)