You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ma...@apache.org on 2018/01/26 13:59:15 UTC

[incubator-openwhisk] branch master updated: Fix overload of invoker. (#3221)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new d585449  Fix overload of invoker. (#3221)
d585449 is described below

commit d585449207d080c3f74c3760dd60ae7afd1a378d
Author: Christian Bickel <gi...@cbickel.de>
AuthorDate: Fri Jan 26 14:59:12 2018 +0100

    Fix overload of invoker. (#3221)
    
    Due to duplicate names of variables, the loadbalancer thought, that the home invoker of an action has still some free slots. But the controller asked for the wrong invoker, so the invoker was totally overloaded.
---
 .../core/loadBalancer/ContainerPoolBalancer.scala    | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/core/controller/src/main/scala/whisk/core/loadBalancer/ContainerPoolBalancer.scala b/core/controller/src/main/scala/whisk/core/loadBalancer/ContainerPoolBalancer.scala
index f2614e0..aed332e 100644
--- a/core/controller/src/main/scala/whisk/core/loadBalancer/ContainerPoolBalancer.scala
+++ b/core/controller/src/main/scala/whisk/core/loadBalancer/ContainerPoolBalancer.scala
@@ -43,9 +43,9 @@ import scala.util.{Failure, Success}
 
 case class LoadbalancerConfig(blackboxFraction: Double, invokerBusyThreshold: Int)
 
-class ContainerPoolBalancer(config: WhiskConfig, instance: InstanceId)(implicit val actorSystem: ActorSystem,
-                                                                       logging: Logging,
-                                                                       materializer: ActorMaterializer)
+class ContainerPoolBalancer(config: WhiskConfig, controllerInstance: InstanceId)(implicit val actorSystem: ActorSystem,
+                                                                                 logging: Logging,
+                                                                                 materializer: ActorMaterializer)
     extends LoadBalancer {
 
   private val lbConfig = loadConfigOrThrow[LoadbalancerConfig](ConfigKeys.loadbalancer)
@@ -219,7 +219,7 @@ class ContainerPoolBalancer(config: WhiskConfig, instance: InstanceId)(implicit
   private val invokerPool = {
     // Do not create the invokerPool if it is not possible to create the health test action to recover the invokers.
     InvokerPool
-      .healthAction(instance)
+      .healthAction(controllerInstance)
       .map {
         // Await the creation of the test action; on failure, this will abort the constructor which should
         // in turn abort the startup of the controller.
@@ -233,9 +233,9 @@ class ContainerPoolBalancer(config: WhiskConfig, instance: InstanceId)(implicit
 
     val maxPingsPerPoll = 128
     val pingConsumer =
-      messagingProvider.getConsumer(config, s"health${instance.toInt}", "health", maxPeek = maxPingsPerPoll)
+      messagingProvider.getConsumer(config, s"health${controllerInstance.toInt}", "health", maxPeek = maxPingsPerPoll)
     val invokerFactory = (f: ActorRefFactory, invokerInstance: InstanceId) =>
-      f.actorOf(InvokerActor.props(invokerInstance, instance))
+      f.actorOf(InvokerActor.props(invokerInstance, controllerInstance))
 
     actorSystem.actorOf(
       InvokerPool.props(invokerFactory, (m, i) => sendActivationToInvoker(messageProducer, m, i), pingConsumer))
@@ -248,7 +248,11 @@ class ContainerPoolBalancer(config: WhiskConfig, instance: InstanceId)(implicit
   val maxActiveAcksPerPoll = 128
   val activeAckPollDuration = 1.second
   private val activeAckConsumer =
-    messagingProvider.getConsumer(config, "completions", s"completed${instance.toInt}", maxPeek = maxActiveAcksPerPoll)
+    messagingProvider.getConsumer(
+      config,
+      "completions",
+      s"completed${controllerInstance.toInt}",
+      maxPeek = maxActiveAcksPerPoll)
   val activationFeed = actorSystem.actorOf(Props {
     new MessageFeed(
       "activeack",
@@ -299,7 +303,7 @@ class ContainerPoolBalancer(config: WhiskConfig, instance: InstanceId)(implicit
         val invokersToUse = if (action.exec.pull) blackboxInvokers(invokers) else managedInvokers(invokers)
         val invokersWithUsage = invokersToUse.view.map {
           // Using a view defers the comparably expensive lookup to actual access of the element
-          case invoker => (invoker.id, invoker.status, currentActivations.getOrElse(instance.toString, 0))
+          case invoker => (invoker.id, invoker.status, currentActivations.getOrElse(invoker.id.toString, 0))
         }
 
         ContainerPoolBalancer.schedule(invokersWithUsage, lbConfig.invokerBusyThreshold, hash) match {

-- 
To stop receiving notification emails like this one, please contact
markusthoemmes@apache.org.