rabbah commented on a change in pull request #4186: Track activation counts in 
ContainerPool (not ContainerProxy)
URL: 
https://github.com/apache/incubator-openwhisk/pull/4186#discussion_r252318601
 
 

 ##########
 File path: 
core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerPool.scala
 ##########
 @@ -140,15 +150,50 @@ class ContainerPool(childFactory: ActorRefFactory => 
ActorRef,
 
         createdContainer match {
           case Some(((actor, data), containerState)) =>
+            //increment active count before storing in pool map
+            val (newData, container) = data match {
+              case p: PreWarmedData => //convert PreWarmedData -> WarmingData 
for concurrent cases
+                if (r.action.limits.concurrency.maxConcurrent > 1) {
+                  WarmingData(p.container, r.msg.user.namespace.name, 
r.action, Instant.now, 1) -> Some(p.container)
+                } else {
+                  p.copy(activeActivationCount = 1) -> Some(p.container)
+                }
+              case w: WarmedData =>
+                w.copy(activeActivationCount = w.activeActivationCount + 1) -> 
Some(w.container)
+              case pw: WarmingData =>
+                pw.copy(activeActivationCount = pw.activeActivationCount + 1) 
-> Some(pw.container)
+              case wnd: WarmingColdData =>
+                wnd.copy(activeActivationCount = wnd.activeActivationCount + 
1) -> None
+              case n: NoData => //convert NoData -> WarmingColdData for 
concurrent cases
+                if (r.action.limits.concurrency.maxConcurrent > 1) {
+                  WarmingColdData(r.msg.user.namespace.name, r.action, 
Instant.now, 1) -> None
+                } else {
+                  n.copy(activeActivationCount = 1) -> None
+                }
+              case m: MemoryData => //convert MemoryData -> WarmingColdData 
for concurrent cases
+                if (r.action.limits.concurrency.maxConcurrent > 1) {
+                  WarmingColdData(r.msg.user.namespace.name, r.action, 
Instant.now, 1) -> None
+                } else {
+                  m.copy(activeActivationCount = 1) -> None
+                }
+            }
+
+            if (newData.activeActivationCount < 1) {
+              logging.error(this, s"invalid activation count < 1 ${newData}")
 
 Review comment:
   having the error logged here is good if someone is paying attention to the 
errors via alerts.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to