Skip to content

fix(examples/Test): busy-wait under Espressif QEMU instead of delay() (#4845) - #4857

Merged
zackees merged 1 commit into
masterfrom
fix/qemu-c3-flake-4845
Oct 16, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/qemu-c3-flake-4845

Conversation

@zackees

@zackees zackees commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Closes #4845. Part of #4844.

Symptom: esp32c3_qemu_test (Test, Test loop!) timed out on #4841 (run 38822465148, attempt 1) and then passed on rerun. The failure artifact shows the chip booting and printing Test setup starting, but never Test loop!.

Local reproduction: CI's exact staging command plus fbuild test-emu --timeout 120 failed 4 of 4 runs on this host. I added temporary prints to the staged copy only:

  • setup() completes, including legacyLibcOnCrgb() and delay(100).
  • loop() runs for about 1 s of emulated time (for example, pass 500 at millis()=947), then stops.
  • The stall point moves around (in another run, after pass 3 at millis()=1161), and it always follows a delay(1). That is Arduino's delay, i.e. vTaskDelay. FastLED's using fl::delay is compiled in only for the stub build.
  • Replacing delay(1) with delayMicroseconds(1000) passed 3 of 3 runs.

Probable cause (consistent with the evidence, not proven): on a loaded host, the emulated timer alarm that wakes the sleeping task is lost, so vTaskDelay never returns. Busy-waiting needs no alarm.

Fix: QEMU only. Under FASTLED_ESP32_IS_QEMU, the loop busy-waits with delayMicroseconds(1000). Real boards keep delay(1), which yields to the idle task. The test still checks boot, setup(), the loop, and millis()-driven EVERY_N_MILLIS.

Evidence:

  • From the committed source: 5 of 5 local passes, with task_wdt added to the halt-on-error patterns, so busy-waiting doesn't trip the task watchdog.
  • bash compile uno --examples Test and bash compile esp32dev --examples Test succeed.
  • bash lint: 0.
  • This PR carries the ci-test:qemu* label, so CI runs the QEMU jobs.

Summary by CodeRabbit

  • Bug Fixes
    • Improved timing behavior in the example when running in ESP32 QEMU; other builds are unchanged.

…#4845)

The esp32c3 QEMU 'Test' job hung after 'Test setup starting'. Local repro
(4/4 failures): setup() completes and loop() runs ~1 s, then a
delay(1) -> vTaskDelay never returns. With delayMicroseconds(1000) the
sketch passes 8/8. Probable cause: on a loaded host the emulated timer
alarm that wakes the sleeping task is lost. QEMU-only (#if
FASTLED_ESP32_IS_QEMU); real boards keep delay(1).
@zackees zackees added the ci-test:qemu* Select FastLED board CI cells label Oct 16, 2026
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Oct 16, 2026
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: FastLED/FastLED/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5b46c840-92b6-4724-a451-5398c29c4b89
📥 Commits

Reviewing files that changed from the base of the PR and between e9174f4 and 6cb9d55.

📒 Files selected for processing: 1
  • examples/Test/Test.ino

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

📝 Walkthrough

The loop in examples/Test/Test.ino uses delayMicroseconds(1000) when FASTLED_ESP32_IS_QEMU is defined. Other builds continue to use delay(1).

Changes: ESP32 QEMU loop delay

Layer / File(s) Summary
Select the loop delay
examples/Test/Test.ino
When FASTLED_ESP32_IS_QEMU is defined, the loop uses delayMicroseconds(1000). Otherwise, it uses delay(1).

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 6cb9d

No concrete remaining failure is established for this QEMU-only loop change, so it appears mergeable with normal checks.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Linked Issues check Warning Issue #4845 asks for investigation of QEMU boot-time and timeout headroom on hosted runners and of partial-boot progress from fbuild test-emu. The PR changes only examples/Test/Test.ino. It provid… Provide reviewable findings for both investigations. Add the required CI or fbuild test-emu code and automated tests when the findings identify a change. Otherwise, document why the existing behavior satisfies each request.
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the main change: replacing delay() with a busy-wait under Espressif QEMU while preserving other build behavior.
Out of Scope Changes check Passed The only change is in examples/Test/Test.ino. The conditional busy-wait directly targets the QEMU timeout in issue #4845. The change preserves delay(1) for real boards and supports the existing lo…
Full details: Linked Issues check

Explanation

Issue #4845 asks for investigation of QEMU boot-time and timeout headroom on hosted runners and of partial-boot progress from fbuild test-emu. The PR changes only examples/Test/Test.ino. It provides a QEMU busy-wait workaround for the observed stall, but it provides no CI timeout/headroom change, fbuild test-emu progress change, or automated test for either requested area. The current PR description also reports no findings for those areas.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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 merged commit 980e789 into master Oct 16, 2026
229 of 237 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Oct 16, 2026
@zackees
zackees deleted the fix/qemu-c3-flake-4845 branch November 5, 2026 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-test:qemu* Select FastLED board CI cells

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

ci: esp32c3 QEMU job is flaky (test-emu timed out, passed on rerun)

1 participant