`ios_xctestrun_runner` skips the simulator cleanup action on early exits and signals
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 67/100
Research direction
Start with ios_xctestrun_runner.template.sh and trace its exit paths, signal handling, and the existing clean_up_simulator_action call. Check the runner’s tests for coverage of early exits and signals, then reproduce with a failing pre_action as described. Done means cleanup runs exactly once for each created simulator and the runner preserves its original exit status.
Written by the indexing model from the issue text.
Description
ios_xctestrun_runner.template.sh runs clean_up_simulator_action as an
ordinary statement near the end of the script. The runner uses
set -euo pipefail and has several exit calls, so any exit before that line
skips cleanup and leaks the simulator the runner created. With the default
cleanup action and reuse_simulator = False, every one of these leaves a
simulator behind. With a custom create/cleanup pair (for example, one that
leases simulators from a pool), the lease is never released.
Exit paths that skip cleanup today:
- The
pre_actionexits nonzero (set -eaborts the runner). - The
post_actionfails withpost_action_determines_exit_code = True(the
runner exits before cleanup). - A configuration error after the simulator is created, such as
screen_capture_formatwithattachment_lifetime = "keepNever", or x86_64
tests on arm64 without a test host. - Any command that
set -eaborts on, such asxcrun llvm-profdata merge
during coverage. - Signals, including the SIGTERM Bazel sends when a test times out.
Steps to reproduce
- Define an
ios_xctestrun_runnerwithreuse_simulator = Falseand a
pre_actionthat runsexit 1. - Run an
ios_unit_testwith that runner. - Run
xcrun simctl list devices: the simulator the runner created is still
there.
Expected
The cleanup action runs exactly once for every simulator the runner creates,
whichever way the runner exits, and the runner keeps its original exit status.
Known limitations
SIGKILL can't be trapped, so a hard kill after the timeout grace period still
skips cleanup. Callers that need a guarantee should also release simulators
outside the test action.
- Dominant language
- Starlark
- Stars
- 600
- Forks
- 354
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 8
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bazelbuild/rules_apple
-
register_binary_linking_action links with the GCC coverage map format under coveragePossibly taken @TrapsterDK claimed this 6 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 30/100
bazelbuild/rules_apple#3160 ·
Maintainers usually reply within 1 day
-
Registered toolchains load //apple/internal and its dependencies in every buildMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 3/5 1-2 days Newbie friendliness 30/100
bazelbuild/rules_apple#3158 ·
Maintainers usually reply within 1 day
-
Simulator cleanup is skipped when the post-action failsPossibly taken @vakhidbetrakhmadov claimed this 14 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 58/100
bazelbuild/rules_apple#3147 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
bazelbuild/rules_apple#3139 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 47/100
bazelbuild/rules_apple#3133 ·
Maintainers usually reply within 1 day
All issues in bazelbuild/rules_apple
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
hnvy/ledgedroid#20 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
PixelPlayerHQ/PixelPlayerOSS#325 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
MetrolistGroup/Metrolist#5789 ·
Maintainers usually reply within 1 day
-
android area: player bug issue
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
-
fixed-pending-release
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
doctorhetfield-cmd/simpleui.koplugin#695 · 1 comment ·
Maintainers usually reply within 1 day