File tree 2 files changed +18
-1
lines changed
src/main/java/com/google/devtools/build/lib 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -733,7 +733,23 @@ public void close() {
733
733
}
734
734
735
735
isClosed = true ;
736
- channelPool .close ();
736
+
737
+ // Clear interrupted status to prevent failure to close, indicated with #14787
738
+ boolean wasInterrupted = Thread .interrupted ();
739
+ try {
740
+ channelPool .close ();
741
+ } catch (RuntimeException e ) {
742
+ if (e .getCause () instanceof InterruptedException ) {
743
+ Thread .currentThread ().interrupt ();
744
+ } else {
745
+ throw e ;
746
+ }
747
+ } finally {
748
+ if (wasInterrupted ) {
749
+ Thread .currentThread ().interrupt ();
750
+ }
751
+ }
752
+
737
753
eventLoop .shutdownGracefully ();
738
754
}
739
755
}
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ public void afterCommand() throws AbruptExitException {
51
51
try {
52
52
executorService .awaitTermination (Long .MAX_VALUE , SECONDS );
53
53
} catch (InterruptedException e ) {
54
+ executorService .shutdownNow ();
54
55
Thread .currentThread ().interrupt ();
55
56
}
56
57
You can’t perform that action at this time.
0 commit comments