Skip to content

Commit 355b872

Browse files
committed
Adjust error for container creation.
When an action is already updated but activations with an old revision arrive, this error can happen. It is not supposed to happen in a normal case but it might happen when a cache invalidation issue happens for some reason.
1 parent f915acc commit 355b872

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

core/invoker/src/main/scala/org/apache/openwhisk/core/invoker/ContainerMessageConsumer.scala

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,18 @@
1717

1818
package org.apache.openwhisk.core.invoker
1919

20-
import java.nio.charset.StandardCharsets
21-
2220
import akka.actor.{ActorRef, ActorSystem, Props}
2321
import org.apache.openwhisk.common.{GracefulShutdown, Logging, TransactionId}
2422
import org.apache.openwhisk.core.WarmUp.isWarmUpAction
2523
import org.apache.openwhisk.core.WhiskConfig
2624
import org.apache.openwhisk.core.connector.ContainerCreationError.DBFetchError
2725
import org.apache.openwhisk.core.connector._
2826
import org.apache.openwhisk.core.containerpool.v2.{CreationContainer, DeletionContainer}
29-
import org.apache.openwhisk.core.database.{
30-
ArtifactStore,
31-
DocumentTypeMismatchException,
32-
DocumentUnreadable,
33-
NoDocumentException
34-
}
27+
import org.apache.openwhisk.core.database.{ArtifactStore, DocumentRevisionMismatchException, NoDocumentException}
3528
import org.apache.openwhisk.core.entity._
3629
import org.apache.openwhisk.http.Messages
3730

31+
import java.nio.charset.StandardCharsets
3832
import scala.concurrent.duration._
3933
import scala.concurrent.{ExecutionContext, Future}
4034
import scala.util.{Failure, Success}
@@ -80,10 +74,12 @@ class ContainerMessageConsumer(
8074
val message = t match {
8175
case _: NoDocumentException =>
8276
Messages.actionRemovedWhileInvoking
83-
case _: DocumentTypeMismatchException | _: DocumentUnreadable =>
77+
case _: DocumentRevisionMismatchException =>
8478
Messages.actionMismatchWhileInvoking
8579
case e: Throwable =>
86-
logging.error(this, s"An unknown DB connection error occurred while fetching an action: $e.")
80+
logging.error(
81+
this,
82+
s"An unknown DB error occurred while fetching action ${creation.invocationNamespace}/${creation.action} for creation ${creation.creationId}, error: $e.")
8783
Messages.actionFetchErrorWhileInvoking
8884
}
8985
logging.error(

tests/src/test/scala/org/apache/openwhisk/core/invoker/test/ContainerMessageConsumerTests.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,10 @@
1717

1818
package org.apache.openwhisk.core.invoker.test
1919

20-
import java.nio.charset.StandardCharsets
21-
2220
import akka.actor.ActorSystem
2321
import akka.testkit.{TestKit, TestProbe}
2422
import common.StreamLogging
2523
import org.apache.openwhisk.common.{Logging, TransactionId}
26-
import org.apache.openwhisk.core.{WarmUp, WhiskConfig}
2724
import org.apache.openwhisk.core.connector.ContainerCreationError._
2825
import org.apache.openwhisk.core.connector._
2926
import org.apache.openwhisk.core.connector.test.TestConnector
@@ -34,13 +31,15 @@ import org.apache.openwhisk.core.entity._
3431
import org.apache.openwhisk.core.entity.size._
3532
import org.apache.openwhisk.core.entity.test.ExecHelpers
3633
import org.apache.openwhisk.core.invoker.ContainerMessageConsumer
34+
import org.apache.openwhisk.core.{WarmUp, WhiskConfig}
3735
import org.apache.openwhisk.http.Messages
3836
import org.apache.openwhisk.utils.{retry => utilRetry}
3937
import org.junit.runner.RunWith
4038
import org.scalamock.scalatest.MockFactory
4139
import org.scalatest.junit.JUnitRunner
4240
import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach, FlatSpecLike, Matchers}
4341

42+
import java.nio.charset.StandardCharsets
4443
import scala.concurrent.Future
4544
import scala.concurrent.duration._
4645
import scala.util.Try
@@ -254,7 +253,7 @@ class ContainerMessageConsumerTests
254253
put(entityStore, whiskAction)
255254
val actualCreationMessage = creationMessage.copy(revision = DocRevision("1-fake"))
256255
val fetchErrorAckMessage =
257-
createAckMsg(actualCreationMessage, Some(DBFetchError), Some(Messages.actionFetchErrorWhileInvoking))
256+
createAckMsg(actualCreationMessage, Some(DBFetchError), Some(Messages.actionMismatchWhileInvoking))
258257
creationConsumer.send(actualCreationMessage)
259258

260259
within(5.seconds) {

0 commit comments

Comments
 (0)