You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2019/02/26 14:57:48 UTC

[GitHub] steffenrost commented on a change in pull request #4299: Avoid that actions do not stop after action timeout when logging heavily

steffenrost commented on a change in pull request #4299: Avoid that actions do not stop after action timeout when logging heavily
URL: https://github.com/apache/incubator-openwhisk/pull/4299#discussion_r260322856
 
 

 ##########
 File path: tests/src/test/scala/org/apache/openwhisk/core/limits/ActionLimitsTests.scala
 ##########
 @@ -463,4 +465,38 @@ class ActionLimitsTests extends TestHelpers with WskTestHelpers with WskActorSys
       _.response.result.get.fields("error") shouldBe Messages.memoryExhausted.toJson
     }
   }
+
+  /**
+   * Test that a heavy logging action is interrupted within its timeout limits.
+   */
+  it should "interrupt the heavy logging action within its time limits" in withAssetCleaner(wskprops) {
+    (wp, assetHelper) =>
+      val name = s"NodeJsTestLoggingActionCausingTimeout-${System.currentTimeMillis()}"
+      print(s"\n create action ${name} using api host: ${wskprops.apihost}..")
+      assetHelper.withCleaner(wsk.action, name, confirmDelete = true) { (action, _) =>
+        action.create(
+          name,
+          Some(TestUtils.getTestActionFilename("loggingTimeout.js")),
+          timeout = Some(allowedActionDuration))
+      }
+      val duration = allowedActionDuration + 3.minutes
+      val checkDuration = allowedActionDuration + 1.minutes
+      val run =
+        wsk.action.invoke(name, Map("durationMillis" -> duration.toMillis.toJson, "delayMillis" -> 100.toJson))
+      withActivation(wsk.activation, run) { result =>
+        withClue("Activation result not as expected:") {
+          result.response.status shouldBe ActivationResponse.messageForCode(ActivationResponse.DeveloperError)
+          result.response.result.get.fields("error") shouldBe {
+            Messages.timedoutActivation(allowedActionDuration, init = false).toJson
+          }
+          val logs = result.logs.get
+          logs.last should include(Messages.logFailure)
+
+          val parseLogTime = (line: String) => Instant.parse(line.split(' ').head)
+          val startTime = parseLogTime(logs.head)
+          val endTime = parseLogTime(logs.last)
+          between(startTime, endTime).asInstanceOf[FiniteDuration] should be < checkDuration
 
 Review comment:
   We tried without, but got `Cannot resolve reference with such as signature`, so we tried with `asInstanceOf[FiniteDuration]` which worked in intellij, but during compile with grade we get now a compile error, so we still trying to solve this problem.
   ```
   /home/vagrant/github.ibm.com/bluewhisk/open/tests/src/test/scala/org/apache/openwhisk/core/limits/ActionLimitsTests.scala:498: diverging implicit expansion for type scala.concurrent.duration.FiniteDuration => Comparable[scala.concurrent.duration.FiniteDuration]
   starting with method $conforms in object Predef
             between(startTime, endTime).asInstanceOf[FiniteDuration] should be < checkDuration
   ```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services