From f6e1074b09ebefba185c0531e9cea26b9596c8a9 Mon Sep 17 00:00:00 2001 From: chiwang Date: Thu, 8 Apr 2021 19:19:17 -0700 Subject: [PATCH] Remote: Use shutdownNow() instead of shutdown() in ChannelConnection#close() as a workaround to a gRPC bug. There is a bug (b/183340374) in gRPC that client doesn't try to close connections with shutdown() if the channel received GO_AWAY frames. Using shutdownNow() here as a workaround. PiperOrigin-RevId: 367552792 --- .../build/lib/remote/grpc/ChannelConnectionFactory.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/google/devtools/build/lib/remote/grpc/ChannelConnectionFactory.java b/src/main/java/com/google/devtools/build/lib/remote/grpc/ChannelConnectionFactory.java index 1e626fff82197e..96d4d3af24f63e 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/grpc/ChannelConnectionFactory.java +++ b/src/main/java/com/google/devtools/build/lib/remote/grpc/ChannelConnectionFactory.java @@ -46,7 +46,10 @@ public ClientCall call( @Override public void close() throws IOException { - channel.shutdown(); + // There is a bug (b/183340374) in gRPC that client doesn't try to close connections with + // shutdown() if the channel received GO_AWAY frames. Using shutdownNow() here as a + // workaround. + channel.shutdownNow(); try { channel.awaitTermination(Integer.MAX_VALUE, SECONDS); } catch (InterruptedException e) {