grpc / grpc-java

The Java gRPC implementation. HTTP/2 based RPC
https://grpc.io/docs/languages/java/
Apache License 2.0
11.48k stars 3.85k forks source link

core: fix test flakiness in retriableStream hedging deadlock test #11606

Closed YifeiZhuang closed 1 month ago

YifeiZhuang commented 1 month ago

The rootcause is reentrant lock has more than one hold count. In this case, lock1 is held when stream4 is created within sublistener.closed callback. It can just be released, no tryLock(), which increment the lock hold count in the current thread, and prevent thread1 from acquiring lock1.

Tested with blaze test --runs_per_test=100: http://sponge2/caeee424-089f-456e-99de-eb82a35558ba

cc. @ejona86