mirror of https://github.com/grpc/grpc-java.git
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.
This commit is contained in:
parent
855740622a
commit
c3d7d74175
|
|
@ -295,8 +295,10 @@ public class CascadingTest {
|
||||||
Context.currentContextExecutor(otherWork).execute(new Runnable() {
|
Context.currentContextExecutor(otherWork).execute(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
synchronized (call) {
|
||||||
call.close(Status.ABORTED, new Metadata());
|
call.close(Status.ABORTED, new Metadata());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else if (req.getResponseSize() != 0) {
|
} else if (req.getResponseSize() != 0) {
|
||||||
// We are in a non leaf node so fire off two requests
|
// We are in a non leaf node so fire off two requests
|
||||||
|
|
@ -316,7 +318,9 @@ public class CascadingTest {
|
||||||
}
|
}
|
||||||
// Propagate closure upwards.
|
// Propagate closure upwards.
|
||||||
try {
|
try {
|
||||||
|
synchronized (call) {
|
||||||
call.close(status, new Metadata());
|
call.close(status, new Metadata());
|
||||||
|
}
|
||||||
} catch (IllegalStateException t2) {
|
} catch (IllegalStateException t2) {
|
||||||
// Ignore error if already closed.
|
// Ignore error if already closed.
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue