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/05/29 08:20:17 UTC

[GitHub] sven-lange-last commented on a change in pull request #3710: Make REST communication with action containers more robust

sven-lange-last commented on a change in pull request #3710: Make REST communication with action containers more robust
URL: https://github.com/apache/incubator-openwhisk/pull/3710#discussion_r191338524
 
 

 ##########
 File path: common/scala/src/main/scala/whisk/core/containerpool/HttpUtils.scala
 ##########
 @@ -105,15 +112,33 @@ protected[core] class HttpUtils(hostname: String, timeout: FiniteDuration, maxRe
 
       response.close()
       containerResponse
+    } recoverWith {
+      // The route to target socket as well as the target socket itself may need some time to be available -
+      // particularly on a loaded system.
+      // The following exceptions occur on such transient conditions. In addition, no data has been transmitted
+      // yet if these exceptions occur. For this reason, it is safe and reasonable to retry.
+      //
+      // HttpHostConnectException: no target socket is listening (yet).
+      case t: HttpHostConnectException => Failure(RetryableConnectionError(t))
+      //
+      // NoRouteToHostException: route to target host is not known (yet).
+      case t: NoRouteToHostException => Failure(RetryableConnectionError(t))
     } match {
-      case Success(r) => r
-      case Failure(t: HttpHostConnectException) if retry =>
-        if (timeoutMsec > 0) {
-          Thread sleep 100
-          val newTimeout = timeoutMsec - 100
-          execute(request, newTimeout, retry)
+      case Success(response) => response
+      case Failure(t: RetryableConnectionError) =>
+        if (retry) {
+          val sleepTime = 10.milliseconds
+          if (timeout.length > 0) {
 
 Review comment:
   Makes perfect sense. I will change.

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