Skip to content

test: ExecServiceTests can no longer stall the suite - #133

Merged
jiunbae merged 1 commit into
mainfrom
fix/exec-test-hang
Oct 26, 2026
Merged

jiunbae merged 1 commit into
mainfrom
fix/exec-test-hang

Conversation

@jiunbae

@jiunbae jiunbae commented Oct 26, 2026

Copy link
Copy Markdown
Member

Root cause of the CI stalls on #128 and #130, which looked like a hang after DockStoreTests.

verifyNaturalExitCleanup started an unrelated /bin/sleep with Process and, after several awaits, cleaned it up in a defer with waitUntilExit(). The defer can resume on a different cooperative thread. There waitUntilExit never observes the exit, because it waits on the launching thread's run loop. So the test hung whenever the thread changed.

Caught locally with sample: the main thread was in XCTWaiter, and a cooperative thread was in -[NSConcreteTask waitUntilExit] at ExecServiceTests.swift:56, with the sleep already gone.

The fix spawns the sleep with posix_spawn and kills and reaps it with kill/waitpid. The assertions are unchanged: same start time, still alive. Ran ExecServiceTests three times in a row: 19/19 each time.

🤖 Generated with Claude Code

verifyNaturalExitCleanup launched a /bin/sleep with Process and, after
several awaits, cleaned it up with waitUntilExit(). Cleanup can resume on
another cooperative thread, where waitUntilExit never observes the exit
(it waits on the launching thread's run loop), so the test hung forever
whenever the thread changed. Sampled locally:
ExecServiceTests.swift:56 in -[NSConcreteTask waitUntilExit], the sleep
long gone. This is the stall CI hit on #128 and #130. Spawn it with
posix_spawn and kill/waitpid it ourselves.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@jiunbae
jiunbae merged commit c03c85c into main Oct 26, 2026
1 check passed
@jiunbae
jiunbae deleted the fix/exec-test-hang branch October 26, 2026 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant