Skip to content

Bazel ignores "cpp_link.cpu" exec properties when linking strategy is set to local #25195

Closed

Description

@zackwintermdb

Description of the bug:

While trying to restrict concurrency to 1 when linking, I tried to set the "cpp_link.mem" and "cpp_link.cpu" exec properties equal to the memory and cpu of the host system, but I'm still getting 5+ link job concurrency. In this configuration --strategy=CppLink=local is set, while the other actions are remote.

To validate that I'm setting the property in the correct place, I checked that the "cpp_link.timeout" flag set adjacent to where I'm setting mem/cpu is getting respected in this test case. The build times out immediately if I set it to 1.

Which category does this issue belong to?

No response

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

  1. Install bazel 7.5.0
  2. Setup several cc_binary targets with long link durations
  3. Set the exec_properties to {"cpp_link.cpu": "100"} (or your cpu on each target
  4. Perform a bazel build
  5. Observe that multiple linker actions are scheduled in parallel

Which operating system are you running Bazel on?

Ubuntu 22.04 ARM64

What is the output of bazel info release?

release 7.5.0

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?


If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

Activity

  1. added
    untriaged
    on Feb 4, 2025
  2. added
    team-Rules-CPP
    on Feb 5, 2025
  3. pzembrod commented on Jun 23, 2025

    @pzembrod
    Contributor

    I'm personally not familiar with exec_properties, but looking at https://bazel.build/reference/be/platforms-and-toolchains#platform.exec_properties I would say that it is WAI if bazel doesn't interpret them when executing local actions.

  4. added and removed
    untriaged
    on Jun 23, 2025
  5. zackwintermdb commented on Jun 23, 2025

    @zackwintermdb
    Author

    @pzembrod is there any other way to restrict the concurrency of specific action types during local execution? This seems like it would be an issue in most large C++ code bases

  6. pzembrod commented on Aug 1, 2025

    @pzembrod
    Contributor

    I'm not aware of a concurrency restriction mechanism for specific action types.
    Is either using --jobs or --local_cpu_resources or --local_ram_resources an option for you?

    Related: #17368 and #25770

  7. keith commented on Apr 13, 2026

    @keith
    Member
  8. iancha1992 commented on Jun 26, 2026

    @iancha1992
    Contributor

    A fix for this issue has been included in Bazel 9.2.0 RC1. Please test out the release candidate and report any issues as soon as possible.
    If you're using Bazelisk, you can point to the latest RC by setting USE_BAZEL_VERSION=9.2.0rc1. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions