kramasamy closed pull request #2863: k8s ensure response body is closed after 
reading an error.
URL: https://github.com/apache/incubator-heron/pull/2863
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/heron/schedulers/src/java/org/apache/heron/scheduler/kubernetes/KubernetesUtils.java
 
b/heron/schedulers/src/java/org/apache/heron/scheduler/kubernetes/KubernetesUtils.java
index c4613b3c39..7f923f0ef4 100644
--- 
a/heron/schedulers/src/java/org/apache/heron/scheduler/kubernetes/KubernetesUtils.java
+++ 
b/heron/schedulers/src/java/org/apache/heron/scheduler/kubernetes/KubernetesUtils.java
@@ -20,6 +20,7 @@
 import com.squareup.okhttp.Response;
 
 import org.apache.heron.common.basics.ByteAmount;
+import org.apache.heron.common.basics.SysUtils;
 import org.apache.heron.scheduler.utils.Runtime;
 import org.apache.heron.spi.common.Config;
 import org.apache.heron.spi.common.Context;
@@ -41,6 +42,7 @@ static void logResponseBodyIfPresent(Logger log, Response 
response) {
       log.log(Level.SEVERE, "Error details:\n" +  response.body().string());
     } catch (IOException ioe) {
       // ignore
+      SysUtils.closeIgnoringExceptions(response.body());
     }
   }
 
@@ -59,6 +61,8 @@ static String errorMessageFromResponse(Response response) {
     } catch (IOException ioe) {
       // ignore
       details = ioe.getMessage();
+    } finally {
+      SysUtils.closeIgnoringExceptions(response.body());
     }
     return message + "\ndetails:\n" + details;
   }


 

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to