Skip to content

ci: Windows x64 release build fails when soldr can't take the cargo build lock (parallel cargo rules) #1407

Closed

Description

@rdoupe

The OBS-Studio-Rust release run started at 08:02 UTC today (run 39109915393, workflow_dispatch on ea5530f) failed in Build windows x64, step "Build OBS-Studio-Rust", and so did Launch packaged Windows x64, which needs that build. No beta can publish until this passes; the last one is still 0.1.0-beta.20261014.

What failed

The MSBuild custom rule _cargo-build_obs_gpu_status_frontend exits with MSB8066. Just before it, soldr reports that it could not take the cargo lock:

08:05:05.28  soldr: no-cache preflight could not acquire build lock \\?\D:\a\obs-studio\obs-studio\build_x64\x64\RelWithDebInfo\cargo\build\release\.cargo-lock: The process cannot access the file because another process has locked a portion of the file
08:05:05.96  error MSB8066: Custom build for '...\_cargo-build_obs_gpu_status_frontend.rule;...' exited with code 1.
...
Build FAILED.

At the same moment, other Rust crates (obs-util, obs-data, obs-properties) were compiling in the same cargo\build\release target directory. That cargo is holding .cargo-lock.

Likely cause

MSBuild runs Corrosion's cargo custom rules in parallel. Each one shares the same target directory, so they serialize on .cargo-lock. Plain cargo waits for that lock ("Blocking waiting for file lock"). soldr's no-cache preflight treats a held lock as an error instead, so whichever cargo rule loses the race fails the whole build. Whether a rule loses depends on timing, so it is intermittent. The full CI run on master 5258daf last night (39094545735) built Windows x64 green.

Possible fixes:

  • soldr's preflight could wait for the lock as cargo does, or skip the preflight when the lock is held;
  • or the Windows release build could serialize the cargo rules, for example with a CMake job pool of size 1 for Corrosion targets, or by building the Rust targets first.

I can't reproduce it locally (no Windows runner here). This report is from the job log only. Refs #1395 (the nightly failure tracker, a different test).

Activity

  1. rdoupe commented on Oct 18, 2026

    @rdoupe
    CollaboratorAuthor

    Root cause in soldr (zackees/soldr 7b5047c, crates/soldr-cli/src/cargo_front_door/no_cache_detach.rs, acquire_build_locks() around lines 355-366):

    • The no-cache preflight (prepare_target_for_unmediated_build, called from run_prepare.rs:740) takes every .cargo-lock under the target directory with try_lock_exclusive(). If any lock is held, it errors instead of waiting the way cargo does ("Blocking waiting for file lock"). With MSBuild running several Corrosion cargo rules in parallel over one cargo\build\release target directory, a held lock is the normal case, not a fault.
    • On Windows the error isn't even the "refused ... while build lock ... is active" path. A byte-range lock held by another process makes LockFileEx fail with ERROR_LOCK_VIOLATION (os error 33, "...another process has locked a portion of the file", the line in the log). Rust's io::ErrorKind for that is neither WouldBlock nor PermissionDenied, so the match falls through to detach_error(..., "acquire build lock", ...).

    A fix that keeps the preflight's guarantee (no other cargo running while it detaches files) would block on the lock, with a timeout, instead of failing on the first held lock: lock_exclusive() in a loop, or try_lock_exclusive() plus a back-off, treating os error 33 as "held" on Windows. Until then, serializing the Corrosion cargo rules on Windows (for example a CMake job pool of size 1 for them) would avoid the race in the release build.

  2. zackees commented on Oct 18, 2026

    @zackees
    Member

    Claiming: Windows release Cargo lock failure. 1. Record both failed release attempts and add a deterministic parallel-CMake regression. 2. Serialize only Corrosion Cargo build targets sharing the target directory, preserving parallel native compilation and the no-cache correctness safeguard. 3. Open a focused PR, validate through the merge queue and release pipeline. First PR shortly. The single targeted infrastructure retry also failed with Windows os error 33, this time in _cargo-build_libobs_rust (job 117627161331). A Ninja job pool alone would not cover MSBuild, so the fix will use target dependencies.

  3. added
    claimed
    on Oct 18, 2026
  4. rdoupe commented on Oct 18, 2026

    @rdoupe
    CollaboratorAuthor

    A separate failure in the same run, which the Cargo lock fix won't cover: Native macOS x86_64 DMG startup (job log around 08:28 UTC).

    • packaged-startup.py launches the app twice. The first launch shuts down cleanly. The second runs, the websocket client disconnects, and OBS shuts down normally ("Shutting down", obs-websocket unloaded, "Freeing OBS context data", the profiler results printed). After that the process dies with SIGSEGV: RuntimeError: packaged app exited during startup: -11.
    • So the crash is in the final teardown, after libobs printed its profiler, on the second launch only. The 15:03 UTC verify run on 10/17 (03b95ac) passed this job, so it may be new since then, or intermittent. There's no crash report in the log, and I can't run macOS x86_64 here to get a backtrace.
  5. zackees commented on Oct 18, 2026

    @zackees
    Member

    PR #1408 fixes this with target dependencies through Corrosion’s public prebuild/build hooks, covering MSBuild as well as Ninja/Make. RED parallel-CMake fixture reproduces the busy-lock error; GREEN orders all three Cargo rules while native work stays concurrent. Full lint and independent review passed. Full native validation run39111717737 passed completely, including Windows x64/ARM64, both macOS architectures, Ubuntu/Flatpak, Rust tests and unchanged C compatibility checks. PR CI passed; merge queue run39112505588 is checking the merge result. Both original failed release attempts remain recorded; no cache-correctness safeguard or runtime gate was removed.

  6. zackees commented on Oct 18, 2026

    @zackees
    Member

    Fixed by #1408, merged as fc4ccf6. PR CI, full native validation39111717737 and merge-queue39112505588 all passed. This orders the three shared-target Cargo preflights through Corrosion’s public targets, leaving native compilation parallel and SOLDR_RUSTC_WRAPPER=none intact. A fresh release dispatch will verify packaged artifacts and runtime gates before publication. Upstream Soldr could eventually wait for held Cargo locks; that is a tool improvement rather than remaining work in this repository fix.

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

    claimed

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions