Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

max-jobs option is ignored #3763

Closed
B4dM4n opened this issue Jun 29, 2020 · 5 comments · Fixed by #4064
Closed

max-jobs option is ignored #3763

B4dM4n opened this issue Jun 29, 2020 · 5 comments · Fixed by #4064
Labels

Comments

@B4dM4n
Copy link
Contributor

B4dM4n commented Jun 29, 2020

Describe the bug

Running nix build on master ignores any max-jobs value set, either by nix.conf, --option max-jobs n or --max-jobs n.

Steps To Reproduce

  1. Run
nix build -j2 -f =(echo 'with import <nixpkgs> { }; with lib; map (n: runCommand "test-${n}" { } "sleep 10") (genList toString 50)')
  1. number of nixbld users builds run at the same time

or

nix build --store /tmp/nix-store -j2 -f =(echo 'with import <nixpkgs> { }; with lib; map (n: runCommand "test-${n}" { } "sleep 10") (genList toString 50)')
  1. All builds run at the same time

Expected behavior

Only two parallel builds should run.

nix-env --version output

nix-env (Nix) 2.4pre20200626_b481d8a ( B4dM4n/nix@b481d8a current flakes branch + minor change)

Additional context

Building via nix-daemon will start one build for every nixbld user, otherwise there is no limit on the number of jobs started.

https://hydra.nixos.org/eval/1588015 is the first build I could find that show this behavior, which would point to #3564 introducing this.

@B4dM4n B4dM4n added the bug label Jun 29, 2020
@SFrijters
Copy link
Member

Seems I'm running into this problem now as well.

@mstone
Copy link

mstone commented Sep 21, 2020

I am also experiencing this bug, I think, on

$ nix --version
nix (Nix) 3.0pre20200917_649d3aa

on Darwin.

Further, building texlive now takes far too long (i.e., does not complete in many minutes, on a single-user install), I think due contention resulting from hundreds or thousands of builder processes being spawned.

/cc @balsoft

@balsoft
Copy link
Member

balsoft commented Sep 23, 2020

Oh, sorry for breaking it :P Thanks for the ping, @mstone!

I have taken a quick look at it and I think I know how to fix it; I will try to find some time, but can't promise anything.

@mstone
Copy link

mstone commented Sep 24, 2020

@balsoft -- not to worry, and thanks for taking a look at it!

Two followup notes:

  1. while I believe I'm seeing the same issue that @B4dM4n described, I haven't done any significant work yet to confirm their analysis / bisection of which commit introduced the problem. As a result, if you find that you've hit a dead end while researching, please let me know and maybe we can explore the issue together -- I just pinged you because I wanted to make sure that you had seen @B4dM4n's issue report.

  2. also, independent of all of the discussion above, congratulations on getting your first nix PR merged!

balsoft added a commit to serokell/nix that referenced this issue Sep 24, 2020
After 0ed946a, max-jobs setting (-j/--max-jobs)
stopped working.

The reason was that nrLocalBuilds (which compared to maxBuildJobs to figure
out whether the limit is reached or not) is not incremented yet when tryBuild
is started; So, the solution is to move the check to tryLocalBuild.

Closes NixOS#3763
@balsoft
Copy link
Member

balsoft commented Sep 24, 2020

Hopefully fixed in #4064

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants