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 2018/10/24 08:36:56 UTC

[GitHub] chetanmeh commented on a change in pull request #4070: Diagnostic info + metrics for Docker command failures and timeouts

chetanmeh commented on a change in pull request #4070: Diagnostic info + metrics for Docker command failures and timeouts
URL: https://github.com/apache/incubator-openwhisk/pull/4070#discussion_r227688699
 
 

 ##########
 File path: core/invoker/src/main/scala/whisk/core/containerpool/docker/ProcessRunner.scala
 ##########
 @@ -52,17 +52,75 @@ trait ProcessRunner {
         case _                 => None
       }
 
-      (process.exitValue(), out.mkString("\n"), err.mkString("\n"), scheduled)
+      (ExitStatus(process.exitValue()), out.mkString("\n"), err.mkString("\n"), scheduled)
     }).flatMap {
-      case (0, stdout, _, scheduled) =>
+      case (ExitStatus(0), stdout, _, scheduled) =>
         scheduled.foreach(_.cancel())
         Future.successful(stdout)
-      case (code, stdout, stderr, scheduled) =>
+      case (exitStatus, stdout, stderr, scheduled) =>
         scheduled.foreach(_.cancel())
-        Future.failed(ProcessRunningException(code, stdout, stderr))
+        timeout match {
+          case t: FiniteDuration if exitStatus.terminatedBySIGTERM =>
+            Future.failed(ProcessTimeoutException(timeout, exitStatus, stdout, stderr))
+          case _ => Future.failed(ProcessRunningException(exitStatus, stdout, stderr))
+        }
     }
+}
+
+case class ExitStatus(statusValue: Int) {
+
+  // Based on The Open Group Base Specifications Issue 7, 2018 edition:
+  // Shell & Utilities - Shell Command Language - 2.8.2 Exit Status for Commands
+  // http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_08_02
+  val STATUS_SUCCESSFULL = 0
 
 Review comment:
   Minor typo 
   ```suggestion
     val STATUS_SUCCESSFUL = 0
   ```

----------------------------------------------------------------
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