Skip to content

Commit

Permalink
[7.1.0] Flip flag --experimental_use_semaphore_for_jobs. (#20646)
Browse files Browse the repository at this point in the history
Bazel 7 upgrades its runtime JVM to 21. However, the implementation of
`ForkJoinPool` in JDK 21 is changed so that the number of concurrent
actions may be larger than `--jobs`.

Flag `--experimental_use_semaphore_for_jobs` was introduced to fix this
problem. This CL flips it to make `--jobs` work again by default.

Fixes #20521.

Commit
3c298fd

PiperOrigin-RevId: 590834204
Change-Id: I0ddf1e1a088eb4d917036350533df94c17ac48e6

Co-authored-by: Googler <chiwang@google.com>
Co-authored-by: Yun Peng <pcloudy@google.com>
  • Loading branch information
3 people authored Jan 11, 2024
1 parent c40d834 commit 5340269
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class BuildRequestOptions extends OptionsBase {

@Option(
name = "experimental_use_semaphore_for_jobs",
defaultValue = "false",
defaultValue = "true",
documentationCategory = OptionDocumentationCategory.EXECUTION_STRATEGY,
effectTags = {OptionEffectTag.HOST_MACHINE_RESOURCE_OPTIMIZATIONS, OptionEffectTag.EXECUTION},
help = "If set to true, additionally use semaphore to limit number of concurrent jobs.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ private void writeNGenrulePackages(int n) throws IOException {
*/
public final void runMultipleLostInputsForRewindPlan() throws Exception {
if (!supportsConcurrentRewinding()) {
testCase.addOptions("--jobs=1", "--experimental_use_semaphore_for_jobs");
testCase.addOptions("--jobs=1");
}
writeNGenrulePackages(ActionRewindStrategy.MAX_ACTION_REWIND_EVENTS + 1);
for (int i = 1; i <= ActionRewindStrategy.MAX_ACTION_REWIND_EVENTS + 1; i++) {
Expand Down
1 change: 0 additions & 1 deletion src/test/shell/bazel/bazel_test_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,6 @@ sh_test(name = "test$i", srcs = [ "test$i.sh" ])
EOF
bazel test --spawn_strategy=standalone \
--jobs=1 \
--experimental_use_semaphore_for_jobs \
--runs_per_test=5 \
--runs_per_test_detects_flakes \
//:test$i &> $TEST_log || fail "should have succeeded"
Expand Down
2 changes: 1 addition & 1 deletion src/test/shell/integration/bazel_testjobs_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function test_no_local_test_jobs_causes_local_resources_to_constrain_test_execut
function test_local_test_jobs_exceeds_jobs_causes_warning() {
create_test_files
# 10 local test jobs, but only 3 jobs, so warning is printed, and only 3 tests run concurrently
bazel test --jobs=3 --experimental_use_semaphore_for_jobs --local_test_jobs=10 --local_cpu_resources=10 \
bazel test --jobs=3 --local_test_jobs=10 --local_cpu_resources=10 \
--runs_per_test=10 //dir:test >& $TEST_log || fail "Expected success"

expect_log 'High value for --local_test_jobs'
Expand Down

0 comments on commit 5340269

Please sign in to comment.