Repository navigation
ci(zbugs-swift): keep stacks when a screenshot test's UI query is stuck - #237
Merged
Merged
Conversation
When a UI query has gone 15 s without an answer, the screenshots job now saves a spindump of the app, the UI-test runner and testmanagerd, the end of xcodebuild's log, and top, under stacks/ in the zbugs-screenshots artifact. It is for the iPhone's first query that hung 41 s and timed out in job 134463464281, whose cause the logs can't show. Nothing else about the run changes: no retries, skips or timeouts. Amp-Thread-ID: https://ampcode.com/threads/T-01a1ecca-7f5f-74f3-af23-3f0aaa149aa1 Co-authored-by: tmm <tmm@tmm.dev>
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.
On #230, the iPhone's first UI query in
testListPagesPastTheFirst200hung for 41.7 s and failed with "Failed to get matching snapshots: Timed out while evaluating UI query" (job 134463464281). Its logs don't show why. With this change, the job saves the stacks the next time a query hangs.What it does. While each
xcodebuild testruns, a watcher reads its output, which is now also tee'd to a file. When the last line is an XCTest query step (Checking,Check for,Find,Get,Requesting,Capturing) and the log has been quiet for 15 s, the watcher writesstacks/<run>-<time>/into thezbugs-screenshotsartifact. It writes once per stall:spindump.txt: 5 s of stacks from the app, the UI-test runner and testmanagerd, sampled together (spindump -onlyTarget -proc …)log.txt: the last 20 lines of xcodebuild's outputtop.txt: system load and the busiest processesNothing else about the run changes: no retries, skips or timeouts. xcodebuild's exit status still decides the run, now through
PIPESTATUS.Why 15 s. While XCTest waits for an element, it logs a check about once a second, so a quiet log after a query step means one query is stuck. In the 18 screenshot jobs since #204, the log went quiet for 15 s or more after a query in 3 jobs:
Check for interrupting elementssteps in jobs that passedIn the other 15 jobs, the longest quiet after a query was 11.5 s. So the watcher would have fired in 3 of 18 jobs, all of them stuck queries.
Checks. On a Mac satellite (macos-26, Xcode 26.3, iPhone 17 Pro on iOS 26.2), I ran the workflow's own "Take screenshots" script under
bash -e, on the iPhone only:IssueRow, twice:stacks/iPhone-*/folder, 15 s after the freeze.ZBugs (suspended),ZBugsUITests-Runnerandtestmanagerd.stacks/folder was written.oxfmt --checkpasses. shellcheck flags only the intended word splitting of the PIDs and the log redirect outsidesudo.