Keep container running for truncated responses (#4754)
* Keep the container running even if the action produced a truncated response.
diff --git a/common/scala/src/main/scala/org/apache/openwhisk/core/entity/ActivationResult.scala b/common/scala/src/main/scala/org/apache/openwhisk/core/entity/ActivationResult.scala
index 6d0085a..d3727c5 100644
--- a/common/scala/src/main/scala/org/apache/openwhisk/core/entity/ActivationResult.scala
+++ b/common/scala/src/main/scala/org/apache/openwhisk/core/entity/ActivationResult.scala
@@ -234,7 +234,7 @@
}
case Some((length, maxlength)) =>
- developerError(truncatedResponse(str, length, maxlength), Some(length.toBytes.toInt))
+ applicationError(JsString(truncatedResponse(str, length, maxlength)), Some(length.toBytes.toInt))
}
case Left(_: MemoryExhausted) =>
diff --git a/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerProxy.scala b/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerProxy.scala
index 570d61a..8010940 100644
--- a/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerProxy.scala
+++ b/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerProxy.scala
@@ -551,7 +551,7 @@
* 4. recording the result to the data store
*
* @param container the container to run the job on
- * @param job the job to run
+ * @param job the job to run
* @return a future completing after logs have been collected and
* added to the WhiskActivation
*/
diff --git a/tests/src/test/scala/org/apache/openwhisk/core/entity/test/ActivationResponseTests.scala b/tests/src/test/scala/org/apache/openwhisk/core/entity/test/ActivationResponseTests.scala
index 59ab350..bbfc197 100644
--- a/tests/src/test/scala/org/apache/openwhisk/core/entity/test/ActivationResponseTests.scala
+++ b/tests/src/test/scala/org/apache/openwhisk/core/entity/test/ActivationResponseTests.scala
@@ -51,7 +51,7 @@
{
val response = ContainerResponse(okStatus = true, m.take(max.toBytes.toInt - 1), Some(m.length.B, max))
val run = processRunResponseContent(Right(response), logger)
- run.statusCode shouldBe DeveloperError
+ run.statusCode shouldBe ApplicationError
run.result.get.asJsObject
.fields(ERROR_FIELD) shouldBe truncatedResponse(response.entity, m.length.B, max).toJson
}
diff --git a/tests/src/test/scala/org/apache/openwhisk/core/limits/ActionLimitsTests.scala b/tests/src/test/scala/org/apache/openwhisk/core/limits/ActionLimitsTests.scala
index b75fb7b..c8255e1 100644
--- a/tests/src/test/scala/org/apache/openwhisk/core/limits/ActionLimitsTests.scala
+++ b/tests/src/test/scala/org/apache/openwhisk/core/limits/ActionLimitsTests.scala
@@ -313,7 +313,7 @@
def checkResponse(activation: ActivationResult) = {
val response = activation.response
response.success shouldBe false
- response.status shouldBe ActivationResponse.messageForCode(ActivationResponse.DeveloperError)
+ response.status shouldBe ActivationResponse.messageForCode(ActivationResponse.ApplicationError)
val msg = response.result.get.fields(ActivationResponse.ERROR_FIELD).convertTo[String]
val expected = Messages.truncatedResponse((allowedSize + 10).B, allowedSize.B)
withClue(s"is: ${msg.take(expected.length)}\nexpected: $expected") {