Repository navigation
fix(adb): Force-stop the app before each launch and after a run timeout - #64
Draft
bitsandfoxes wants to merge 1 commit into
Draft
bitsandfoxes wants to merge 1 commit into
bitsandfoxes wants to merge 1 commit into
Conversation
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.
AdbProvidernow force-stops the package before it launches it, and again after a run that didn't exit within the run timeout.Until now, a run that hung left its process alive, and the provider only printed a warning. The next
am start -Wthen didn't start a new process: it brought the hung activity back to the front, sopidofreturned the same PID, the run waited out the full timeout again, andlogcat --pidreturned next to nothing. One hung launch failed every launch after it. In sentry-unity's Android integration tests, 7 jobs in the last 30 days went this way (e.g. 118708786184:App PID: 4056for all five launches, 0 of 81 tests passed, 25 of the job's 30 minutes spent waiting).How it works now:
RunApplicationrunsam force-stop <package>before clearing logcat and launching, so every launch starts a fresh process. This matches whatiOSSimulatorProvider(simctl terminate) andSauceLabsProvider(mobile: terminateApp) already do before a launch.force-stoponly logs a warning; the launch goes ahead as before.I left out an early "the app logged nothing yet" timeout: the provider has no app-agnostic readiness signal (what an app logs first is up to the engine), and adding one means a new
Invoke-DeviceAppparameter for every provider plus logcat polling in the monitor loop. Callers that know their app can detect a launch that never initialised from the returned output and relaunch it, which sentry-unity does in getsentry/sentry-unity#2901.Tests:
AdbRunApplication.Tests.ps1covers the order of commands on a normal run and on a timeout, and that a failing force-stop doesn't block the launch, withInvokeCommandfaked (no device needed).Stacked on #63.
CI evidence: run 40185846696, with a throwaway commit (since dropped) that made the first launch wait for a debugger, so it never initialised. In all 4 Run Android jobs, the first launch (Message Capture) waited out the timeout, then logged
::warning::Android app never initialised, relaunching (1/1). The relaunch came up under a new PID (e.g. 121151142372:4326→6421) and each job passed 77/77 (4 skipped).🤖 Generated with Claude Code