Description
Hello,
we are starting a grpc-server in a Go testserver.
On test finish we call Server.GracefulStop()
via t.Cleanup()
.
We forward all log messages from the grpc packages to the test logger, by setting grpclog.SetLoggerV2
to a t.Log
wrapper.
When we run the tests with the -race
parameter, it happens from now and then that a race is detected because loopyWriter logs a message to t.Log()
after the test finish.
As I understand Server.GracefulStop()
does not wait until the loopyWriter go-routine has terminated.
The message that is logged after test termination from loopyWriter happens here:
grpc-go/internal/transport/controlbuf.go
Line 543 in b8d36ca
GracefulStop
.
Is there a way to wait in a testcase until loopyWriter terminated that I'm missing?
If not, shouldn't it be possible to do a termination that ensures no go-routines are running afterwards?
This would also e.g. work well together with https://github.com/uber-go/goleak, that checks if any go-routines are leaked in a testcase.
grpc-go version: 1.57