You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by bd...@apache.org on 2023/04/03 16:23:47 UTC

[openwhisk] branch master updated: fix memory queue stuck in removed state edge case (#5388)

This is an automated email from the ASF dual-hosted git repository.

bdoyle pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new fedf02278 fix memory queue stuck in removed state edge case (#5388)
fedf02278 is described below

commit fedf0227803401f7ac6cf3a33d9e14fc6fac74e8
Author: Brendan Doyle <bd...@gmail.com>
AuthorDate: Mon Apr 3 09:23:36 2023 -0700

    fix memory queue stuck in removed state edge case (#5388)
    
    Co-authored-by: Brendan Doyle <br...@qualtrics.com>
---
 .../org/apache/openwhisk/core/scheduler/queue/MemoryQueue.scala      | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/core/scheduler/src/main/scala/org/apache/openwhisk/core/scheduler/queue/MemoryQueue.scala b/core/scheduler/src/main/scala/org/apache/openwhisk/core/scheduler/queue/MemoryQueue.scala
index d21a6104d..bb8a1b572 100644
--- a/core/scheduler/src/main/scala/org/apache/openwhisk/core/scheduler/queue/MemoryQueue.scala
+++ b/core/scheduler/src/main/scala/org/apache/openwhisk/core/scheduler/queue/MemoryQueue.scala
@@ -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
 
@@ -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 {