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 @@ -729,7 +729,23 @@ public void close() {
729
729
}
730
730
731
731
isClosed = true ;
732
- channelPool .close ();
732
+
733
+ // Clear interrupted status to prevent failure to close, indicated with #14787
734
+ boolean wasInterrupted = Thread .interrupted ();
735
+ try {
736
+ channelPool .close ();
737
+ } catch (RuntimeException e ) {
738
+ if (e .getCause () instanceof InterruptedException ) {
739
+ Thread .currentThread ().interrupt ();
740
+ } else {
741
+ throw e ;
742
+ }
743
+ } finally {
744
+ if (wasInterrupted ) {
745
+ Thread .currentThread ().interrupt ();
746
+ }
747
+ }
748
+
733
749
eventLoop .shutdownGracefully ();
734
750
}
735
751
}
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