Skip to content

Cargo ignores GNU Make jobserver only when using make -j1. #17209

Description

@jnms-me

Problem

When invoking cargo build from GNU Make through make -j1, Cargo should limit the amount of spawned jobs to 1, as it implements a jobserver protocol client.
Specifically when there is only a single job slot available, Cargo instead spawns as many jobs as there are CPU cores available.
All other cases appear to behave correctly.

Steps

git clone https://github.com/rust-lang/rust-analyzer.git
cd rust-analyzer
cat >Makefile <<EOF
all:
	+cargo build
.PHONY: all
EOF

Observe that make -j2 correctly only spawns at most 2 rustc instances at a time.

Observe that make -j1 or make will spawn many rustc instances that saturate the host cpu.

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.97.0 (c980f4866 2026-06-30)
release: 1.97.0
commit-hash: c980f4866141969fab6254a680546a277789d6f0
commit-date: 2026-06-30
host: x86_64-unknown-linux-gnu
libgit2: 1.9.2 (sys:0.20.4 vendored)
libcurl: 8.20.0-DEV (sys:0.4.88+curl-8.20.0 vendored ssl:OpenSSL/3.6.2)
ssl: OpenSSL 3.6.2 7 Apr 2026
os: Linux [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-jobserverArea: jobserver, concurrency, parallelismC-bugCategory: bugS-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions