You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mb...@apache.org on 2022/02/15 14:25:16 UTC

[asterixdb] 04/05: [NO ISSUE][HTTP] Fork the close of response stream on interrupt

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

mblow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git

commit a6c858bb541c371bf5530d9caebf31a0b59fb0e9
Author: Michael Blow <mb...@apache.org>
AuthorDate: Sat Feb 12 08:45:40 2022 -0500

    [NO ISSUE][HTTP] Fork the close of response stream on interrupt
    
    Change-Id: I0a49ae5b1d3d59f68e769bef45c39e0242e312bc
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/15243
    Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Reviewed-by: Michael Blow <mb...@apache.org>
    Reviewed-by: Ali Alsuliman <al...@gmail.com>
    Tested-by: Michael Blow <mb...@apache.org>
---
 .../main/java/org/apache/hyracks/http/server/utils/HttpUtil.java  | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/utils/HttpUtil.java b/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/utils/HttpUtil.java
index e433c02..9f01123 100644
--- a/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/utils/HttpUtil.java
+++ b/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/utils/HttpUtil.java
@@ -236,7 +236,13 @@ public class HttpUtil {
         try {
             return readFuture.get();
         } catch (InterruptedException ex) { // NOSONAR -- interrupt or rethrow
-            response.close();
+            executor.submit(() -> {
+                try {
+                    response.close();
+                } catch (IOException e) {
+                    LOGGER.debug("{} ignoring exception thrown on stream close due to interrupt", description, e);
+                }
+            });
             try {
                 readFuture.get(1, TimeUnit.SECONDS);
             } catch (TimeoutException te) {