Skip to content

fix(ci): prevent macOS ASan runner hangs - #3644

Merged
zackees merged 7 commits into
masterfrom
fix/3643-bound-dll-touch-wait
Jul 15, 2026
Merged

zackees merged 7 commits into
masterfrom
fix/3643-bound-dll-touch-wait

Conversation

@zackees

@zackees zackees commented Jul 15, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #3643. That PR fixed compile/run overlap and NO_PARALLEL handling, but its macOS 26 validation still hung after compilation completed. This PR contains bounded diagnostics and the matched-toolchain fix for the remaining Apple ASan failure.

Root cause evidence

Diagnostic run: https://github.com/FastLED/FastLED/actions/runs/29385930873/job/87259086238

Compilation completed and 267 artifacts were collected. Ten runners then hit the bounded timeout without emitting even the first async-signal-safe startup marker. The stall is before main(), during sanitizer runtime initialization.

This exactly matches LLVM #200447: llvm/llvm-project#200447

On macOS 26.4, older ASan runtimes recursively allocate while inspecting dyld's shared cache and deadlock during initialization. Apple shipped the fix in Xcode 26.4+; Xcode 26.5 is confirmed to resolve the minimal repro.

GitHub's current macos-26 image uses macOS 26.4 and Xcode 26.5 by default, but FastLED's debug build was compiled and linked through clang-tool-chain with its bundled Clang 19 sanitizer runtime.

Superseded runtime-only attempt

Commit 573a05d93a tried to compile with clang-tool-chain Clang 19 while selecting Xcode's Clang 21 resource directory only at link time. The acceptance run failed immediately with undefined symbol: __asan_version_mismatch_check_v8: https://github.com/FastLED/FastLED/actions/runs/29387594533/job/87264018034

That proves the compiler instrumentation and sanitizer runtime must be selected as one ABI-compatible toolchain.

Root fix

On Apple debug builds only:

  • resolve clang, clang++, and ar from the selected Xcode via xcrun;
  • use those Xcode tools consistently for compiler detection, Meson's native file, and setup environment;
  • link with Xcode clang's native ld64 path and Darwin's default shared sanitizer runtime;
  • disable clang-tool-chain-libdeploy, which could otherwise copy the bundled compiler-rt beside an Xcode-linked binary;
  • query the Xcode compiler version rather than accepting the old marker by mtime, forcing incompatible Clang 19 objects to be cleaned during migration.

Apple quick/release builds retain clang-tool-chain and LLD. Linux and Windows are unchanged. Complete ASan instrumentation (including globals), UBSan, debug symbols, and macos-latest remain enabled.

Diagnostics and containment

  • preserve captured runner output when the Python subprocess timeout fires;
  • use a 90-second outer timeout on macOS, retaining 600 seconds elsewhere;
  • emit unbuffered phase markers from startup through teardown;
  • arm the Apple watchdog before crash setup and dynamic loading;
  • keep its SIGALRM path async-signal-safe (write(2) + _exit(2) only);
  • compile the watchdog call chain in a dedicated uninstrumented macOS-only library;
  • link the same watchdog into unit-test and example runners;
  • avoid the pending-SIGALRM cancellation race.

Existing bounded optimizer wait

  • cap DLL mtime-optimizer waiting at 30 seconds with 200 ms cancellation polling;
  • propagate timeout diagnostics through CompileOnlyResult;
  • add deterministic success/timeout coverage;
  • exercise every LPC board declared by the AutoResearch filter.

Validation

  • focused toolchain/streaming regressions: 20 passed;
  • Python CI tests excluding the unrelated local QEMU integration: 517 passed, 39 skipped, 5 subtests passed;
  • Ruff check and format check: passed;
  • clean forced Meson reconfiguration and C++ rebuild: passed;
  • C++ unit/example targets: 350/350 passed;
  • Python, C++, and Meson review passes: clean.

Issue #3642 remains open until the macOS unit workflow passes on this PR, the PR is merged, and both macOS unit and example workflows pass on current master without orphan runner processes.

Summary by CodeRabbit

  • Bug Fixes
    • Prevent streaming builds from hanging by bounding DLL-touch optimization waits and surfacing timeouts in compilation output.
    • Apply platform-appropriate subprocess timeouts, preserving captured runner output on failures.
    • Improve macOS runner watchdog behavior with explicit lifecycle phase tracking and more reliable cancellation/termination.
    • Refine macOS debug build linking/sanitizer behavior to match the selected toolchain.
  • Tests
    • Add/strengthen timeout-boundness and diagnostics checks for streaming execution coordination.
    • Expand supported-board assertions for AutoResearch.
    • Add Meson native toolchain regression coverage for Apple debug behavior.

Fail the streaming build with a propagated diagnostic if DLL mtime optimization stalls. Add timeout coverage, exercise the newly supported LPC AutoResearch boards, and document the intentional pre-fix regression hook.

Follow-up to #3643.
@coderabbitai

coderabbitai Bot commented Jul 15, 2026 •

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The streaming build and test paths now use bounded waits and preserve timeout output. macOS runners gain a shared phase-tracking watchdog, while debug builds use Xcode tools and revised linking. AutoResearch compilation coverage adds four LPC-family boards.

Changes

Streaming execution coordination

Layer / File(s) Summary
Bounded DLL touch synchronization
ci/meson/streaming.py, ci/tests/test_streaming_runner_artifact_validation.py
Adds monotonic bounded waiting for DLL touch completion, reports timeout output, marks compilation failed, and tests completion and timeout paths.
Bounded test process coordination
ci/meson/streaming_runner.py, ci/tests/test_streaming_runner_artifact_validation.py
Adds platform-specific process timeouts, centralizes process waiting, and preserves captured output for failed tests and timeout diagnostics.

Apple runner watchdog

Layer / File(s) Summary
Watchdog contract and implementation
src/platforms/apple/runner_watchdog.hpp, tests/shared/apple_runner_watchdog.cpp
Adds phase tracking, configurable SIGALRM setup, timeout reporting, and cancellation.
Runner lifecycle phase tracking
src/platforms/apple/run_example.hpp, src/platforms/apple/run_unit_test.hpp
Updates Apple runners to record lifecycle phases and cancel the watchdog on failure or completion.
macOS watchdog build wiring
ci/meson/native/meson.build, examples/meson.build, tests/meson.build
Builds the watchdog library on macOS and links it into example and test runners.

Apple debug toolchain

Layer / File(s) Summary
Build-mode-aware Meson setup
ci/meson/build_config.py, ci/meson/runner.py, ci/meson/runner_helpers.py
Propagates build mode through compiler, native-file, environment, and zccache setup.
Xcode toolchain selection
ci/meson/meson_setup_execute.py, ci/tests/test_meson_native_toolchain.py
Uses Xcode-resolved tools for Apple debug builds, invalidates stale compiler markers, and tests debug versus non-debug selection.
Apple debug link configuration
ci/meson/native/meson.build
Removes LLD and shared ASan runtime selection flags from macOS debug linking while retaining sanitizer flags.

AutoResearch board coverage

Layer / File(s) Summary
Expanded supported-board test matrix
ci/tests/test_sketch_filter.py
Adds lpc845, lpc845brk, lpcxpresso845max, and lpcxpresso804 to the supported-board compilation cases.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

  • FastLED/FastLED#3643: Updates the same streaming DLL touch synchronization path and related coordination tests.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main change: fixing macOS ASan runner hangs in CI.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/3643-bound-dll-touch-wait

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@zackees zackees changed the title fix(ci): bound DLL touch optimizer wait fix(ci): bound and diagnose macOS runner hangs Jul 15, 2026
@zackees zackees changed the title fix(ci): bound and diagnose macOS runner hangs fix(ci): prevent macOS ASan runner hangs Jul 15, 2026
@zackees

zackees commented Jul 15, 2026

Copy link
Copy Markdown
Member Author

Acceptance-run follow-up: the first matched-toolchain job failed during Meson's compiler sanity check, not in ASan and not by cancellation: https://github.com/FastLED/FastLED/actions/runs/29388323772/job/87266129472

xcrun --find clang++ correctly selected Xcode 26.5 / Apple Clang 21, but directly invoking that binary did not select a macOS SDK. The sanity link therefore failed with ld: library 'c++' not found.

Commit e6a85aa254 adds the missing Xcode SDK integration:

  1. Resolve the active SDK with xcrun --sdk macosx --show-sdk-path.
  2. Add -isysroot <SDK> to Apple-debug C/C++ compile and link built-in options in the Meson native file.
  3. Set SDKROOT for Meson setup/compiler probes.
  4. Pass Meson's native cpp_args into both manual PCH compiler commands, which otherwise bypass normal target options.
  5. Add regression coverage for SDK resolution, compile/link sysroot emission, setup environment, and both PCH command sites.

Local validation after this correction: focused regressions 22 passed plus 2 subtests; full Python 519 passed / 39 skipped / 7 subtests; forced C++ reconfiguration/build/execution 350/350; Python and Meson reviews clean.

The replacement macOS job is now the acceptance run. The issue remains open and no merge will occur until it is green.

@zackees
zackees merged commit efd5de2 into master Jul 15, 2026
10 checks passed
@zackees
zackees deleted the fix/3643-bound-dll-touch-wait branch July 15, 2026 04:56
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant