grpc-go
grpc-go copied to clipboard
fix: Flaky test ClientSendsAGoAway
Fixes #7160
fix: goaway_test/TestClientSendsAGoAway
didn't use to wait for channels to be ready and which is why sometimes it was not able to read the frame and eventually result in test failure. This PR change make sure we read the frame only when the channel's state becomes READY.
RELEASE NOTES: n/a
Probably need some more description about the fix
From chat offline:
Actually, this structure of the test actually proves there is a bug here that I don't think you're fixing If a connection is created, we want it to reliably get a goaway. We know a connection exists otherwise we won't get to this part of the code, because the channel passes it along
So I think the test is correct (though it can still be simplified), but there is a race in the code that prevents the GOAWAY from being sent in some cases.
@dfawley updated the PR.
Update: this is the code where we are hardcode closing the transport. Will update the PR with the change where we send goAway frame in this case as well.
@dfawley As per our discussion offline, we won't be waiting for all the transport conn to close down. So this PR's change is ready to review as it just makes sure we are waiting for the clientconn to be READY.