diff --git a/interop-testing/src/test/java/io/grpc/testing/integration/CascadingTest.java b/interop-testing/src/test/java/io/grpc/testing/integration/CascadingTest.java index 4b23519b6f..81ac60571a 100644 --- a/interop-testing/src/test/java/io/grpc/testing/integration/CascadingTest.java +++ b/interop-testing/src/test/java/io/grpc/testing/integration/CascadingTest.java @@ -295,7 +295,9 @@ public class CascadingTest { Context.currentContextExecutor(otherWork).execute(new Runnable() { @Override public void run() { - call.close(Status.ABORTED, new Metadata()); + synchronized (call) { + call.close(Status.ABORTED, new Metadata()); + } } }); } else if (req.getResponseSize() != 0) { @@ -316,7 +318,9 @@ public class CascadingTest { } // Propagate closure upwards. try { - call.close(status, new Metadata()); + synchronized (call) { + call.close(status, new Metadata()); + } } catch (IllegalStateException t2) { // Ignore error if already closed. }