From c3d7d74175b958f612e55911dd7ab86fc0a0ba33 Mon Sep 17 00:00:00 2001 From: Carl Mastrangelo Date: Mon, 15 Jul 2019 11:17:54 -0700 Subject: [PATCH] interop-testing: fix race in CascadingTest ServerCall.close() is meant to only be accessed from a single thread, but in the test it is accessed from the callbacks of several client calls. Synchronize access to sate TSAN. --- .../java/io/grpc/testing/integration/CascadingTest.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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. }