Fix CI: force-kill emulator to prevent 20+ min hang after tests#2805
Merged
Fix CI: force-kill emulator to prevent 20+ min hang after tests#2805
Conversation
On API 26 google_apis, the emulator process does not exit after receiving adb emu kill. The android-emulator-runner post-step polls until the process dies, which never happens before the 30-minute job timeout triggers, wasting ~23 minutes of CI time. Force-kill the qemu-system process at the end of the test script, before the action's post-step cleanup runs. When the post-step then checks whether the process has exited, it is already gone and the cleanup step exits immediately.
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.
Problem
On API 26
google_apis, the emulator process does not exit after receivingadb emu kill.The
android-emulator-runnerpost-step polls in a loop waiting forkill -0 $pidto fail.The process never dies before the 30-minute job timeout, so the CI runner cancels the job
with
The operation was canceled.— roughly 23 minutes after the tests actually finished.This has happened consistently on API 26 (confirmed in runs for PR #2802 and earlier):
Fix
Add
pkill -9 -f "qemu-system" || trueat the end of the test script, before theandroid-emulator-runnerpost-step cleanup runs. When the post-step then checks whetherthe process is alive, it is already gone and the cleanup exits immediately.
The
|| truemakes it a no-op on API levels where the emulator shuts down cleanly.