>From Michael Blow <[email protected]>:

Michael Blow has uploaded this change for review. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17687 )


Change subject: [NO ISSUE][HYR] Avoid hang in SuperActivityOperatorNodePushable 
on NC shutdown
......................................................................

[NO ISSUE][HYR] Avoid hang in SuperActivityOperatorNodePushable on NC shutdown

Change-Id: Ic25d0b8722055c5abbda0de1f5475c14b68ae001
---
M 
hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/rewriter/runtime/SuperActivityOperatorNodePushable.java
1 file changed, 16 insertions(+), 0 deletions(-)



  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/87/17687/1

diff --git 
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/rewriter/runtime/SuperActivityOperatorNodePushable.java
 
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/rewriter/runtime/SuperActivityOperatorNodePushable.java
index e43d72a..e9f5ab5 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/rewriter/runtime/SuperActivityOperatorNodePushable.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/rewriter/runtime/SuperActivityOperatorNodePushable.java
@@ -30,6 +30,7 @@
 import java.util.Queue;
 import java.util.Set;
 import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.CancellationException;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.concurrent.Semaphore;
@@ -240,6 +241,12 @@
             }
         } catch (ExecutionException e) {
             root = e.getCause();
+        } catch (CancellationException e) {
+            root = e;
+            // if a task has been cancelled, the executor has shut down and 
will no longer start tasks; adjust the
+            // semaphores accordingly to allow cancelTasks() to run without 
getting blocked.
+            completeSemaphore.release(-startSemaphore.drainPermits() + 1);
+            startSemaphore.release();
         } catch (Throwable e) { // NOSONAR: Must catch all causes of failure
             root = e;
         }

--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17687
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: neo
Gerrit-Change-Id: Ic25d0b8722055c5abbda0de1f5475c14b68ae001
Gerrit-Change-Number: 17687
Gerrit-PatchSet: 1
Gerrit-Owner: Michael Blow <[email protected]>
Gerrit-MessageType: newchange

Reply via email to