Skip to content

Fix TestDial_Tracing/stream flaking again

Sami Hiltunen requested to merge smh-fix-dial-tracing-flake into master

There was a previous attempt at synchronizing the test by waiting for the server to close the stream (!3141 (merged)). There is another race in the test as well though.

The client first sends the stream close to the server and then goes off to finish the client span. If the server receives the client stream closing before the client managed to finish its span, the server will race finishing its 'nested span' with the client's '/mwitkow.testproto/TestService/PingStream' span. The racy client code can be seen here: https://github.com/grpc-ecosystem/go-grpc-middleware/blob/v1.2.2/tracing/opentracing/client_interceptors.go#L80-L84.

This commit fixes the race by synchronizing the server's stream handler to only proceed after the client has returned from the CloseSend method.

Closes #3402 (closed)

Merge request reports

Loading