-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix flaky test #70
Fix flaky test #70
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This refactor makes sense but I'd like to understand the problem a bit more first to make sure we're not just working around it.
I believe this happens because when triggering a graceful shutdown on the server, the quiescing event is translated into a cancellation error if there are connections still open.
What function is surfacing that error?
Tests/GRPCNIOTransportHTTP2Tests/HTTP2TransportTLSEnabledTests.swift
Outdated
Show resolved
Hide resolved
|
41b6e20
to
0f5d940
Compare
What triggers the cancellation? |
In the current implementation we have a discarding throwing task group with one task running the server and the other running the client requests. In this type of task group, when one task throws, the others are cancelled. In rare instances where the client throws, the server task would get cancelled before the server is gracefully shut down. This would trigger the |
HTTP2TransportTLSEnabledTests/testServerFailsClientValidation
would rarely fail with aCancellationError
being unexpectedly thrown.I believe this happens because when triggering a graceful shutdown on the server, the quiescing event is translated into a cancellation error if there are connections still open. However, whether this error is surfaced seems to have to do with the timing of both the client and the server shutting down.
I have refactored the test to use nested
withGRPCServer
/withGRPCClient
with-style methods instead, as this should eliminate timing issues.