Skip to content

test: fl_task_executor 'fl::task::run SYSTEM yield paths' is flaky under full-suite load #3772

Closed

Description

@zackees

Split out of #3761 / PR #3771, where it failed twice and passed twice in the same session.

Symptom

[236/357] ✗ fastled:fl_task_executor FAILED (2.16s)
  FAIL: fl::task::run SYSTEM yield paths at ../../tests/fl/task/executor.cpp:1075
  [doctest] test cases: 25 | 24 passed | 1 failed

Evidence it is a flake, not a regression

Within one session, on the same tree:

run result
bash test --cpp (full) FAILED
bash test --cpp (full) 357/357 passed
bash test --cpp --clean (full) FAILED
bash test --cpp (full) 357/357 passed
bash test fl_task_executor --cpp (isolated, unmodified master) passed
bash test fl_task_executor --debug (ASAN/LSAN/UBSAN) passed clean

It only fails as part of the full suite, never in isolation, and sanitizers report nothing. That points at a timing/scheduling assumption in the SYSTEM-yield path that does not hold when the machine is loaded by parallel test execution, rather than a memory or UB bug.

Why it matters

It is a false red in the gate the project relies on to decide whether to merge. An agent or developer seeing it has to spend a full re-run to distinguish it from a real break — and the tempting wrong move is to assume every failure of it is noise.

Suggested direction

tests/fl/task/executor.cpp:1075 — check whether the assertion depends on wall-clock progress or on a yield completing within a bounded time. If so, either give it slack proportional to observed scheduling delay, or restructure it to assert on the state transition rather than the timing.

Activity

  1. zackees commented on Jul 31, 2026

    @zackees
    MemberAuthor

    Reproduced on CI, which pins down the mechanism.

    PR #3771 (a Python-only build-system change that cannot touch C++ runtime behavior) hit it on the macOS runner:

    [MESON] ❌ Some tests failed (273/274 tests in 294.76s)
    FAIL: fl::task::run SYSTEM yield paths at ../../tests/fl/task/executor.cpp:1075
    

    A re-run of the same job on the same commit passed. So it now has: 2 failures + 2 passes locally on Windows, 1 failure + 1 pass on macOS CI, and a clean pass in isolation under ASAN/UBSAN.

    Mechanism

    The subcase is a wall-clock assertion:

    FL_SUBCASE("a zero budget does not sleep") {
        fl::u32 best = 0xFFFFFFFFu;
        for (int i = 0; i < 5; ++i) {
            const fl::u32 t0 = fl::micros();
            run(0, ExecFlags::SYSTEM);
            const fl::u32 dt = fl::micros() - t0;
            if (dt < best) best = dt;
        }
        FL_CHECK_LT(best, 250u);
    }

    The existing comment anticipates the problem and uses best-of-5 for it:

    Best-of-N: this bounds a wall clock, so a single sample can be inflated by OS preemption. A regression that made this path sleep would raise every sample, which best-of-N cannot hide.

    That reasoning is right about a regression, but best-of-5 does not survive sustained contention — and that is the condition here. The test only fails as part of the full suite, where hundreds of other test binaries are competing for cores, so all 5 samples can be inflated together. Isolation always passes because there is no contention.

    Suggested fix, without weakening the guard

    The assertion is trying to separate a fl::yield() (single-digit µs) from a sleep (>= ~1000µs, one tick). 250µs is far tighter than that separation requires, so it can be made much more robust without losing the ability to catch the regression it exists for:

    • Raise N substantially (each sample is supposed to be sub-250µs, so 50 samples is still cheap), and/or
    • Move the threshold to ~500µs, which still sits well below a one-tick sleep.

    Both keep "a regression that made this path sleep would raise every sample" true, while giving the clean-sample search enough attempts to win under load.

    Deliberately not fixed in #3771 — relaxing an unrelated regression guard to make an unrelated PR green is the wrong shape of change, even when the guard is the thing that is wrong.

  2. moved this from Triage to Done in FastLED Trackeron Jul 31, 2026
  3. added a commit that references this issue on Jul 31, 2026
    bdf2efc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions