Skip to content

Commit

Permalink
Adjust error for container creation. (#5295)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
style95 authored Jul 27, 2022
1 parent f915acc commit 4912565
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,18 @@

package org.apache.openwhisk.core.invoker

import java.nio.charset.StandardCharsets

import akka.actor.{ActorRef, ActorSystem, Props}
import org.apache.openwhisk.common.{GracefulShutdown, Logging, TransactionId}
import org.apache.openwhisk.core.WarmUp.isWarmUpAction
import org.apache.openwhisk.core.WhiskConfig
import org.apache.openwhisk.core.connector.ContainerCreationError.DBFetchError
import org.apache.openwhisk.core.connector._
import org.apache.openwhisk.core.containerpool.v2.{CreationContainer, DeletionContainer}
import org.apache.openwhisk.core.database.{
ArtifactStore,
DocumentTypeMismatchException,
DocumentUnreadable,
NoDocumentException
}
import org.apache.openwhisk.core.database.{ArtifactStore, DocumentRevisionMismatchException, NoDocumentException}
import org.apache.openwhisk.core.entity._
import org.apache.openwhisk.http.Messages

import java.nio.charset.StandardCharsets
import scala.concurrent.duration._
import scala.concurrent.{ExecutionContext, Future}
import scala.util.{Failure, Success}
Expand Down Expand Up @@ -80,10 +74,12 @@ class ContainerMessageConsumer(
val message = t match {
case _: NoDocumentException =>
Messages.actionRemovedWhileInvoking
case _: DocumentTypeMismatchException | _: DocumentUnreadable =>
case _: DocumentRevisionMismatchException =>
Messages.actionMismatchWhileInvoking
case e: Throwable =>
logging.error(this, s"An unknown DB connection error occurred while fetching an action: $e.")
logging.error(
this,
s"An unknown DB error occurred while fetching action ${creation.invocationNamespace}/${creation.action} for creation ${creation.creationId}, error: $e.")
Messages.actionFetchErrorWhileInvoking
}
logging.error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@

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

import java.nio.charset.StandardCharsets

import akka.actor.ActorSystem
import akka.testkit.{TestKit, TestProbe}
import common.StreamLogging
import org.apache.openwhisk.common.{Logging, TransactionId}
import org.apache.openwhisk.core.{WarmUp, WhiskConfig}
import org.apache.openwhisk.core.connector.ContainerCreationError._
import org.apache.openwhisk.core.connector._
import org.apache.openwhisk.core.connector.test.TestConnector
Expand All @@ -34,13 +31,15 @@ import org.apache.openwhisk.core.entity._
import org.apache.openwhisk.core.entity.size._
import org.apache.openwhisk.core.entity.test.ExecHelpers
import org.apache.openwhisk.core.invoker.ContainerMessageConsumer
import org.apache.openwhisk.core.{WarmUp, WhiskConfig}
import org.apache.openwhisk.http.Messages
import org.apache.openwhisk.utils.{retry => utilRetry}
import org.junit.runner.RunWith
import org.scalamock.scalatest.MockFactory
import org.scalatest.junit.JUnitRunner
import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach, FlatSpecLike, Matchers}

import java.nio.charset.StandardCharsets
import scala.concurrent.Future
import scala.concurrent.duration._
import scala.util.Try
Expand Down Expand Up @@ -254,7 +253,7 @@ class ContainerMessageConsumerTests
put(entityStore, whiskAction)
val actualCreationMessage = creationMessage.copy(revision = DocRevision("1-fake"))
val fetchErrorAckMessage =
createAckMsg(actualCreationMessage, Some(DBFetchError), Some(Messages.actionFetchErrorWhileInvoking))
createAckMsg(actualCreationMessage, Some(DBFetchError), Some(Messages.actionMismatchWhileInvoking))
creationConsumer.send(actualCreationMessage)

within(5.seconds) {
Expand Down

0 comments on commit 4912565

Please sign in to comment.