File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed 
src/main/java/com/google/devtools/build/lib Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -729,7 +729,23 @@ public void close() {
729729      }
730730
731731      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+ 
733749      eventLoop .shutdownGracefully ();
734750    }
735751  }
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ public void afterCommand() throws AbruptExitException {
5151    try  {
5252      executorService .awaitTermination (Long .MAX_VALUE , SECONDS );
5353    } catch  (InterruptedException  e ) {
54+       executorService .shutdownNow ();
5455      Thread .currentThread ().interrupt ();
5556    }
5657
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments