bazelbuild / bazelbuild/bazel

Support --block_for_lock=<N>s

Open
#31,053 0 comments 0 reactions 0 assignees View on GitHub
team-OSS team-Performance type: feature request untriaged
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the feature request:

Support a max waiting time for a lock to be released.

### Which category does this issue belong to?

_No response_

### What underlying problem are you trying to solve with this feature?

While it is supported to fail immediately when there is a lock or waiting forever, it doesn't fit into the use case where we do run multiple commands in parallel and let Bazel itself to "coordinate" using the lock file, while at the same time we do not want any command to infinitely wait for a lock to be released, in case of a real stuck command.

"timeout bazel ..." won't solve this issue either because we want to avoid waiting for lock forever, but not to kill the actual command. For example "bazel run /foo/bar", once "/foo/bar" is built, the lock is released, and we don't want to put a timeout to "/foo/bar" itself.

### Which operating system are you running Bazel on?

Any OS

### What is the output of `bazel info release`?

release 9.2.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` ?

```text
NA
```

### Have you found anything relevant by searching the web?

Not really.

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

_No response_

Contributor guide

Open the contributing guide

Research direction

The issue names no source files or tests; start by tracing Bazel's command lock acquisition and the existing --block_for_lock behavior. Define how a finite wait is reported and verify that the timeout only stops lock waiting, while the eventual command continues normally after the lock is released.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.