Skip to content

Apparent race condition with build pipelining and/or target dir locking #16790

@olson-dan

Description

@olson-dan

Problem

I'll apologize in advance that I don't have a way to easily package a repro for this, but I hope that it's valuable to report this in any case.

We recently upgraded from 1.87.0 to 1.94.0. Our CI/CD started hitting rmeta errors. We thought this might be due to stale rlib/rmeta files from the older version sitting around on our workers. In order to try to deal with this, we hashed the rustc -vV output and appended this to the CARGO_BUILD_TARGET_DIR and CARGO_BUILD_BUILD_DIR folders. We observed that this did not resolve the issue, and moreover that it was occurring on workers that had previously performed successful builds on 1.94.0.

The errors are of this type:

   Compiling once_cell v1.18.0
error: only metadata stub found for `rlib` dependency `cfg_if`
       please provide path to the corresponding .rmeta file with full metadata
error: cannot resolve a prelude import

After some more research I learned about build pipelining, which apparently attempts to use the .rmeta files before the .rlib has been generated to unblock later compilation steps.

I'm seeing this in two cases.

The one I can sort of explain is our test job, where we run cargo test --package <p> on 2-3 crates in the same workspace simultaneously. This could imply a target dir locking issue. Maybe this isn't a recommended way to do this, but it was working without issue on 1.87.0.

The one I can't really explain doesn't feel like it should be an esoteric setup at all. We're invoking cargo from an MSBUILD custom step as part of a larger C++ project. Only one crate builds in this project, with the namespace target and build dirs. So I don't have a good idea of why that one might be occurring, but it's failing with the exact same type of error.

I'm turning pipelining off in my root config.toml and I'm expecting this to solve it for now. Everything else I've tried has been unsuccessful.

Steps

No response

Possible Solution(s)

I'm turning pipelining off in my root config.toml and I'm expecting this to solve it for now. Everything else I've tried has been unsuccessful.

Notes

No response

Version

cargo 1.94.0 (85eff7c80 2026-01-15)
release: 1.94.0
commit-hash: 85eff7c80277b57f78b11e28d14154ab12fcf643
commit-date: 2026-01-15
host: x86_64-pc-windows-msvc
libgit2: 1.9.2 (sys:0.20.3 vendored)
libcurl: 8.17.0-DEV (sys:0.4.84+curl-8.17.0 vendored ssl:Schannel)
os: Windows 10.0.26100 (Windows 11 Enterprise) [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-jobserverArea: jobserver, concurrency, parallelismC-bugCategory: bugS-needs-infoStatus: Needs more info, such as a reproduction or more background for a feature request.regression-from-stable-to-stableRegression in stable that worked in a previous stable release.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions