Repository navigation
[ci] Bound logcat capture time - #12471
Merged
simonrozsival merged 2 commits intoAug 21, 2026
Merged
simonrozsival merged 2 commits into
simonrozsival merged 2 commits into
Conversation
The unconditional logcat capture can wait forever when an earlier step fails before an emulator is available. This blocks the remaining pipeline tasks until the entire job times out. Skip capture when adb reports no connected device and give the task a one-minute timeout to handle a device disconnecting between the check and capture. Co-authored-by: Copilot App <[email protected]> Copilot-Session: d2b3073e-c161-4458-9eb2-1fd1760e68f5
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Azure Pipelines APK instrumentation template to prevent the “capture logcat” step (run under always()) from hanging indefinitely when no emulator/device is available, by adding a device-presence guard and enforcing a short step timeout.
Changes:
- Switch logcat capture to a multi-line script with a pre-check that skips capture when
adb devicesreports no connected device. - Add
timeoutInMinutes: 1to bound the logcat capture step runtime even if the device disconnects oradb logcatstalls. - Keep the step best-effort (
always()+continueOnError: true) so diagnostics collection doesn’t block later publishing steps.
The logcat guard treats every unsuccessful device check as an empty device list, which can produce a misleading diagnostic when adb itself fails. Preserve and print the adb devices output, and report a nonzero exit code separately from the no-connected-device case. Co-authored-by: Copilot App <[email protected]> Copilot-Session: d2b3073e-c161-4458-9eb2-1fd1760e68f5
simonrozsival
approved these changes
Aug 21, 2026
simonrozsival
enabled auto-merge (squash)
August 21, 2026 08:19
This was referenced Sep 8, 2026
simonrozsival
added a commit
that referenced
this pull request
Sep 18, 2026
---- `adb logcat -d` can stall even after `adb devices` reports a connected emulator. Azure Pipelines then applies the one-minute task timeout added by #12471, records an error, and converts the task to `SucceededWithIssues` because it uses `continueOnError`. The final `fail-on-issue.yaml` step intentionally turns that status into a job failure. This occurred in builds [1583273](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1583273) and [1585745](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1585745). The log-volume reduction in #12620 does not prevent adb or emulator communication from stalling. Add a reusable PowerShell helper that bounds device discovery to 10 seconds and logcat collection to 45 seconds. It redirects logcat directly to the existing artifact path, preserving complete output on success and partial output on timeout, kills timed-out process trees with a bounded grace period, emits an explicit Azure warning, and exits successfully for capture-only failures. The pipeline keeps `condition: always()` but no longer relies on task-level timeout or `continueOnError`, so diagnostic capture cannot change `Agent.JobStatus`. `fail-on-issue.yaml` remains unchanged and continues to gate unrelated build and test failures. Related: #12704 Prior mitigations: #12471, #12620 - [x] Useful description of *why the change is necessary*. - [x] Links to issues fixed - [ ] Unit tests - N/A; the production helper runs in every APK instrumentation lane.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Pull Request
title and
description
should follow the
commit-messages.mdworkflow documentation, and in particular should include:adb logcat -dwaits indefinitely when an earlier pipeline step fails before an emulator is available. Because logcat capture runs underalways(), this can block the remaining tasks until the entire job times out.Skip capture when
adb devicesreports no connected device. Also apply a one-minute task timeout so a device disconnect between the check and capture cannot hang the job.