Repository navigation
Description
Meta-tracker for the #2420 / #2994 timing regression. Opening this because the root cause I published on #2994 was wrong and the issue was auto-closed on it. This issue records the retraction, what is actually established, and the work left.
Correction: the refresh throttle is not the cause
I claimed on #2994 that the drift came from FreeRTOS tick quantization inside CFastLED::show()'s refresh-rate throttle, and #3764 was merged on that basis (auto-closing #2994).
The throttle never executes in the reporter's sketch.
show() is gated by ms_fast_led at 5 ms. Subtracting the ~1050 us WS2812 transmit for 35 LEDs, the throttle sees ~3950 us elapsed against mNMinMicros = 1250 us at setMaxRefreshRate(800):
show() called every 5000 us
WS2812 transmit, 35 LEDs 1050 us
elapsed seen by throttle 3950 us
mNMinMicros @ setMaxRefreshRate(800) 1250 us
throttle engages? NO (3950 >= 1250, loop condition false on first check)
So the code path #3764 changed is not reached by this sketch and cannot explain the reported drift.
How the wrong conclusion survived review: the supporting arithmetic (predicted 25-299 ms vs reported 63-300 ms) was produced by choosing a per-frame jitter fraction freely across an order of magnitude. Three arbitrary multipliers will bracket almost any target. That was curve-fitting presented as confirmation, and the one falsifying check — does the throttle condition ever evaluate true here? — was never run despite the sketch being available throughout.
What the evidence actually points to
Reported drift is 68-257 ms over 254 fade steps = 268-1012 us per step. A single WS2812 show() for 35 LEDs is ~1050 us.
The per-step excess is the same order as one show() call, which points at show() duration (and the resulting loop-poll latency around the millisDelay deadline) rather than any throttle quantization. The reporter's loop polls justFinished() once per iteration, so a longer show() widens the window between a 5 ms deadline passing and the poll observing it, and that excess accumulates across 254 steps.
The open question is therefore: why did FastLED.show() get slower between 3.10.3 and master on ESP32-S3? Candidates, unranked and unmeasured:
- the RMT5 / channels driver rewrite (per-frame setup cost,
waitForConditiontiers) - transposition / encoding cost per frame
EngineEventsonBeginFrame/onEndFramelistener work- per-frame allocation or logging added since 3.10.3
Established and worth keeping
Not everything from the investigation was wrong:
fl::task::run(<non-zero>, SYSTEM)discards itsmicrosecondsargument and hardcodespumpCoroutines(1000)(executor.cpp.hpp:138). Every caller asking for a shorter yield silently gets 1000 us, then tick-rounded. Real bug, independent of [Bug] Compounded timing inaccuracy on master compared to 3.10.3 (Follow-up to #2420) #2994.ICoroutineRuntime::needsDeepYield()is dead code — implemented atcoroutine_esp32.impl.hpp:88, called from nowhere, duplicatingNetworkDetectorwith weaker semantics (no BT, no Ethernet).- fix(core): adaptive yield in show()'s refresh throttle (#3762, fixes #2994) #3764's own threshold is wrong: it guards the deep yield with
remaining > spinBudget(250 us) when a deep yield costs up to one tick (1000 us). Simulated over 200k frames at 800 Hz / 1 kHz tick, that leaves ~281 us mean overshoot where a tick-period threshold leaves zero. Minor now that we know the path is rarely hit, but still incorrect. AutoResearchTimingDrift.hfaithfully replays the reporter's sketch and exposestimingDriftTestover JSON-RPC — but it has no host driver. Nothing inci/references it and there is no--timing-driftflag, so it has never been run.
Work items
- Reopen [Bug] Compounded timing inaccuracy on master compared to 3.10.3 (Follow-up to #2420) #2994. It is closed as COMPLETED on a retracted root cause and is almost certainly still broken.
- Post the correction on [Bug] Compounded timing inaccuracy on master compared to 3.10.3 (Follow-up to #2420) #2994 so the reporter is not left believing it is fixed.
- Add a host driver for
timingDriftTest(a--timing-driftflag) so the existing reproducer can actually run. - Measure
FastLED.show()duration on 3.10.3 vs master for a 35-LED WS2812 strip, ESP32-S3. This is the decisive measurement. - Bisect the
show()duration regression once a delta is confirmed. - Fix
executor.cpp.hpp:138to honor itsmicrosecondsargument. - Wire up or delete
needsDeepYield(). - Correct fix(core): adaptive yield in show()'s refresh throttle (#3762, fixes #2994) #3764's threshold to the deep-yield cost (tick period) rather than the spin budget.
Blocker
On-device validation is currently blocked by fbuild on this bench — orphaned mkdir install-locks, a stale daemon endpoint surviving daemon stop, and an esptool provisioning failure that kills the daemon. Filed as FastLED/fbuild#1213. Every failure mode was silent at the client: bash compile exits 0 while printing ERROR! There were 1 failures, and fbuild deploy exits 1 printing only a version notice.
Related
- [Bug] Compounded timing inaccuracy on master compared to 3.10.3 #2420 — original report
- [Bug] Compounded timing inaccuracy on master compared to 3.10.3 (Follow-up to #2420) #2994 — follow-up report (wrongly closed)
- show() refresh throttle takes an unconditional deep yield — gate on NetworkDetector, or drop it now that transposition is fast (root cause of #2994) #3762 — adaptive-yield issue; still open, holds the executor/needsDeepYield items
- fix(core): adaptive yield in show()'s refresh throttle (#3762, fixes #2994) #3764 — merged; genuine improvement to the throttle path, but not a fix for [Bug] Compounded timing inaccuracy on master compared to 3.10.3 (Follow-up to #2420) #2994
- Orphaned mkdir install-locks deadlock after daemon crash; stale daemon endpoint survives 'daemon stop'; esptool provisioning failure kills daemon fbuild#1213 — bench blocker
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Jul 29, 2026
Status: 6 of 8 items done, 2 blocked on hardware
Three PRs merged since this issue opened.
Done
show()on both versions; confirmsetMaxRefreshRate(0)changes nothing — which would falsify my retraction if it did).executor.cpp.hpphonors itsmicrosecondsargument — fix(task): clamp the SYSTEM yield to the caller's budget; drop dead needsDeepYield (#3765) #3766.needsDeepYield()wired up or deleted — deleted in fix(task): clamp the SYSTEM yield to the caller's budget; drop dead needsDeepYield (#3765) #3766, along with itsisWiFiActive()helper and theesp_wifiinclude that served only it.timingDriftTest— feat(autoresearch): host driver for the #2994 timing-drift reproducer (#3765) #3768.ci/autoresearch/test_timing_drift.py.setWaitSpinBudgetUs) already exposes both. Recommendation: keep the current default.Blocked
show()duration, 3.10.3 vs master — the decisive comparison.Both need a board. The ESP32-C6 dropped off the USB bus during deploy attempts (VID_303A no longer enumerates) and needs a physical replug; FastLED/fbuild#1213 tracks the fbuild failures that preceded it.
What the search has narrowed to
Two independent results now bracket the cause:
tests/profile/fastled_show.cpp(fix(profile): repairbash profile, add a show() CPU-cost benchmark (#3765) #3767) measures the CPU-side per-frame path at ~2 us/frame for 35 LEDs — three orders of magnitude below [Bug] Compounded timing inaccuracy on master compared to 3.10.3 (Follow-up to #2420) #2994's 268-1012 us of per-step excess. So the regression is not inEngineEvents, the three-pass controller walk, dithering/scaling, or the feat(channels): compile-time Bus binding via templated ChannelConfig (eliminates Channel API binary bloat) #2428 channels dispatch.That benchmark cannot see encoding/bit-transposition, DMA, or driver wait loops, because the host driver is a stub. Those are now the prime suspects precisely because they are what it cannot measure.
test_timing_drift.pycloses the loop: the firmware already returnsshow_min_us/show_max_us/show_total_us, which nothing consumed. One run on each version answers it — ifshow()sits well above the ~1050 us wire floor for a 35-LED WS2812 frame, that excess is the regression.Two process findings worth keeping
AutoResearchTimingDrift.hfaithfully replayed the sketch and exposedtimingDriftTest, but nothing inci/referenced it, so it had never been run. That is plausibly why this went a year with a wrong root cause — including mine: one run would have refuted my throttle hypothesis immediately. Hypotheses were being tested by argument because the measurement path did not exist.bash profilewas broken for every target (fixed in fix(profile): repairbash profile, add a show() CPU-cost benchmark (#3765) #3767) —profile_runner.pypassed--build, which argparse abbreviation-matched into--build-mode, eating its value.Both are the same shape: measurement tooling that existed on paper but could not be invoked.
zackees commentedon Jul 29, 2026
Closing. This tracker was opened to do three things, and all three are done:
Merged
task::run()clamps its SYSTEM yield to the caller's budget; deleted deadneedsDeepYield()+ itsisWiFiActive()helper and orphanedesp_wifiincludebash profile— broken for every target; addedtests/profile/fastled_show.cppci/autoresearch/test_timing_drift.py— the host driver the #2994 reproducer never hadResolved by analysis
#3764's threshold — answered on #3762. It is a tradeoff, not a defect: the 250 us default costs ~140 ms/sequence of jitter at 0.6% CPU, while the 1000 us tick threshold gives exact timing at 10% CPU that starves lwIP — the exact thing #2254 fixed.
setWaitSpinBudgetUs()already exposes both ends, so this is a documented-default question. Recommendation recorded: keep the current default.Handed off, not dropped
The two remaining items — measure
show()duration on 3.10.3 vs master, then bisect — are the live investigation, and they belong on #2994, which is reopened. Full state, the decision rule, and the exact command are posted there, so this tracker is now redundant rather than incomplete.They need a board. The ESP32-C6 here dropped off the USB bus (VID_303A stopped enumerating) and needs a physical replug; the fbuild failures that preceded it are FastLED/fbuild#1213.
The finding most worth keeping
Two pieces of measurement tooling existed on paper but could not be invoked: the
timingDriftTestreproducer had no host driver, andbash profilewas broken for every target. That is plausibly why #2994 survived a year with a wrong root cause — mine included. One run of that reproducer would have refuted my throttle hypothesis immediately; instead it got settled by argument, and the arithmetic I offered as confirmation was curve-fitting.Both tools now work. The next hypothesis gets measured instead of argued.
fix(task): clamp the SYSTEM yield to the caller's budget; drop dead n…
fix(profile): repair `bash profile`, add a show() CPU-cost benchmark (F…
feat(autoresearch): host driver for the FastLED#2994 timing-drift rep…