Skip to content

bug: local Tier 2 never rebuilds libobs unity groups after a .c.h edit (ninja records no header deps) #2244

Closed

Description

@zackees

Location

rust/tools/linux-validate/run.sh (the tier2-linux lane of ci/local_gate.py) reuses a per-checkout build volume (obs-rust-linux-validate-build-<id>). In that tree, ninja has zero recorded header dependencies for 11 objects, all of them libobs unity groups or the libobs PCH:

$ ninja -t deps | grep '#deps 0,'
libobs/CMakeFiles/libobs-objects.dir/cmake_pch.h.gch: #deps 0
libobs/CMakeFiles/libobs-objects.dir/build/libobs.core+.h.c.o: #deps 0
libobs/CMakeFiles/libobs-objects.dir/build/libobs.core-source+.h.c.o: #deps 0
libobs/CMakeFiles/libobs-objects.dir/build/libobs.core-output+.h.c.o: #deps 0
libobs/CMakeFiles/libobs-objects.dir/build/libobs.graphics+.h.c.o: #deps 0
libobs/CMakeFiles/libobs-c-reference.dir/build/libobs.ported-util+.h.c.o: #deps 0
... (11 in all)

Every other object has its usual 15-660 deps. build.ninja does set DEP_FILE for these objects, and they are compiled through LAUNCHER = zccache.

Effect

An edit to any .c.h that one of these unity files includes never triggers a recompile. Tier 2 then runs the new tests against the old libobs and reports a wrong RED/GREEN.

Seen while working on #2185:

  • libobs.so.30 in the volume stayed at 19:38 UTC through four runs after edits to libobs/obs-source-transition.c.h.
  • A temporary fprintf added there never appeared, and its string isn't in either libobs.so.
  • Touching libobs/build/libobs.core-source+.h.c forced a recompile, which then failed with redefinition errors from obs-internal.h. That fits the PCH (also #deps 0) being stale as well.

CI is not affected (fresh build trees). The local gate stamp is affected: it can attest Tier 2 for a commit whose libobs changes were never compiled.

Likely cause (unverified)

On a cache hit, zccache restores the .o but not the -MD -MF depfile, or writes an empty one. Ninja then records 0 deps for that edge. Objects whose last compile was a miss keep their deps, which explains why only some objects are affected.

Proposed fix and failing test

  • RED: in a scratch tree, build libobs twice through zccache, the second time from a warm cache in a fresh build dir. ninja -t deps for libobs.core-source+.h.c.o then shows #deps 0. Alternatively: edit a .c.h and check that ninja -n libobs schedules no rebuild.
  • GREEN: zccache restores (or regenerates) the depfile on a hit, so the object lists its headers and the edit schedules a rebuild. If zccache can't be fixed quickly, validate.sh could detect #deps 0 edges after the build and fail, or force --clean.

Workaround: rust/tools/linux-validate/run.sh --clean.

Activity

  1. zackees commented on Oct 24, 2026

    @zackees
    MemberAuthor

    Claiming: #2244. 1) reproduce with zccache directly: compile a file with -MD -MF twice through zccache, cold then warm, and check the depfile on the hit; 2) if zccache drops it, file that upstream (zackees/zccache) with the repro, and land a guard here so Tier 2 can't test stale libobs: validate.sh fails, or rebuilds, when ninja records 0 deps for an object it compiled; 3) RED/GREEN for the guard.

  2. added
    claimed
    on Oct 24, 2026
  3. moved this from In progress to Triage in obs-rust Multiviewon Oct 25, 2026
  4. added
    ready
    and removed
    claimed
    on Oct 25, 2026
  5. moved this from Triage to In progress in obs-rust Multiviewon Oct 25, 2026
  6. zackees commented on Oct 26, 2026

    @zackees
    MemberAuthor

    Status of the claim plan:

    1. Reproduce in zccache directly: not reproduced. With zccache 1.15.5 in the Tier 2 image, every depfile is correct: cold, then hits from three build dirs with CMake-style relative -MT/-MF, and 64 parallel compiles over four rounds (none missing or empty when the client returned). The bug is real, though. Build volume …-e829c156d95d (last built 2026-10-21) has #deps 0 for libcaption, glad, libobs.nsgif, two PCHs and a cmocka stub, all written in one 1.5 s window at the start of the build.
    2. Upstream: filed C/C++ hit can leave an empty depfile: ninja records #deps 0 and never rebuilds the object forge-ci/zccache#1992 with that evidence. It suggests treating an empty or missing stored depfile on a hit as a miss.
    3. Guard: done in tier2: rebuild objects ninja recorded with no header dependencies (#2244) #2249. drop-depless-objects.sh deletes #deps 0 objects before each Tier 2 build, so the local gate can no longer test stale libobs. The three volumes built since (2026-10-25) have no #deps 0 entries.

    Nothing more is needed here. The root cause is tracked upstream, so I'm closing this.

  7. moved this from In progress to Done in obs-rust Multiviewon Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ready

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions