This is an automated email from the ASF dual-hosted git repository.

karthikz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-heron.git


The following commit(s) were added to refs/heads/master by this push:
     new df58705  k8s ensure response body is closed after reading an error. 
(#2863)
df58705 is described below

commit df58705cb63d24cd717da2ad598c901f414b0b84
Author: cckellogg <cckell...@gmail.com>
AuthorDate: Tue Apr 17 23:21:36 2018 -0700

    k8s ensure response body is closed after reading an error. (#2863)
    
    * k8s ensure response body is closed after reading an error.
    
    * Add another closing case.
---
 .../java/org/apache/heron/scheduler/kubernetes/KubernetesUtils.java   | 4 ++++
 1 file changed, 4 insertions(+)

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 c4613b3..7f923f0 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 java.util.logging.Logger;
 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 @@ final class KubernetesUtils {
       log.log(Level.SEVERE, "Error details:\n" +  response.body().string());
     } catch (IOException ioe) {
       // ignore
+      SysUtils.closeIgnoringExceptions(response.body());
     }
   }
 
@@ -59,6 +61,8 @@ final class KubernetesUtils {
     } catch (IOException ioe) {
       // ignore
       details = ioe.getMessage();
+    } finally {
+      SysUtils.closeIgnoringExceptions(response.body());
     }
     return message + "\ndetails:\n" + details;
   }

-- 
To stop receiving notification emails like this one, please contact
karth...@apache.org.

Reply via email to