Repository navigation
test: fix two Linux CI flakes: receive loop deadlines and a leaked sign-in continuation - #408
Merged
Merged
Conversation
Two tests in ClientReceiveLoopTerminationTests failed on the Ubuntu 24.04 job of #407, a change to StdioTransport only. The 2-second limit of outcome(within:) ran out in both. Neither found a wrong result. The tests that ran alongside took 4.4 to 5.0 seconds each, so the overloaded runner did not get to the client's work within the limit. The reconnect test also failed the same way on an unrelated branch's iOS job. Every wait in the suite for something that must finish now uses one 10-second limit. A passing test returns as soon as the operation does, so the limit only adds time when a test fails, and the suite's one-minute time limit still applies. The 200 ms check that a request does not fail early keeps its short limit. Assisted-by: Claude
"Cancelling connect during sign-in stops waiting promptly" holds the server/discover sign-in until release(). Cancelling connect can also send notifications/cancelled for that request. Its POST gets a 401 as well, which starts a second sign-in while the first one waits. SlowSignInAuthorizer kept one continuation, so the second sign-in replaced the first. The dropped continuation was freed without being resumed, and the runtime printed SWIFT TASK CONTINUATION MISUSE. The server/discover POST stayed suspended for the rest of the run. The mock now keeps every waiting sign-in, and release() resumes them all. The warning appears in the Linux CI logs. On a 2-CPU Linux container it showed up in 4 of 4 full test runs, each with a second challenge for notifications/cancelled. After the change it showed up in none of 6. Assisted-by: Claude
varun06
approved these changes
Nov 30, 2026
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
This fixes two test problems that show up in the Linux CI runs of
#407, which only changes
StdioTransport.Receive loop tests time out on a loaded runner
Two tests in
ClientReceiveLoopTerminationTestsfail when a 2-secondoutcome(within:)limit runs out:
Neither has found a wrong result. When they fail, the unrelated tests around them take 3.3
to 5.0 seconds each, so the runner is overloaded and the cooperative pool does not run the
client's work in time. The reconnect test's later checks pass, which means the reconnect
did finish, just after the limit. #407 failed this way on Ubuntu 24.04, then twice more on
RHEL UBI 9 when the failed jobs were re-run. The reconnect test also failed the same way
on the iOS job of an unrelated branch (
oss/network-heartbeat-framing).Every wait in this suite for something that must finish now uses one limit,
completionLimit, set to 10 seconds. A passing test returns as soon as the operationfinishes, so the higher limit only adds time when a test fails. Each test still has the
suite's one-minute
.timeLimit. The 200 ms check that a request does not fail early("A replaced connection closing does not affect the current one") keeps its short limit,
and the 1-second cleanup wait is unchanged.
SWIFT TASK CONTINUATION MISUSEfrom the mock authorizerThe Linux logs print:
It comes from
SlowSignInAuthorizerinClientConnectionFailureTests. "Cancellingconnect during sign-in stops waiting promptly" holds the
server/discoversign-in untilrelease(). Cancellingconnectcan also sendnotifications/cancelledfor thatrequest. Its POST gets a 401 as well, which starts a second sign-in while the first one
waits. The mock kept one continuation, so the second sign-in replaced the first. The
dropped continuation was freed without being resumed, and the
server/discoverPOST stayedsuspended for the rest of the run. Which of the two gets there first depends on
scheduling, which is why the warning shows up on loaded Linux runners and not on macOS.
The mock now keeps every waiting sign-in, and
release()resumes them all. This changesonly test code.
How Has This Been Tested?
swift testpasses on macOS, and so doClientReceiveLoopTerminationTestsandClientConnectionFailureTestsrun on their own.CI logs, where every test running alongside took more than the old limit.
scripts/ci-linux.sh --cpus 2).Before the change it showed up in 4 of 4 full test runs, each time with a second challenge
for
notifications/cancelled. After it, it showed up in none of 6 runs, and every runpassed.
Breaking Changes
None. Only test code changes.
Types of changes
AI Assistance
Drafted with an AI coding agent (Claude), then reviewed by me.