Skip to content

Nix build hangs with "download thread waiting for 10000 ms" loop #13025

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

Open
2 tasks done
thomasjm opened this issue Apr 15, 2025 · 6 comments
Open
2 tasks done

Nix build hangs with "download thread waiting for 10000 ms" loop #13025

thomasjm opened this issue Apr 15, 2025 · 6 comments
Labels
bug fetching Networking with the outside (non-Nix) world, input locking

Comments

@thomasjm
Copy link
Contributor

Describe the bug

I'm having this issue very similar to #11249, where I try to run a Nix build in a container-like environment and get an endless loop like this:

download thread waiting for 10000 ms
download thread waiting for 10000 ms
download thread waiting for 10000 ms
download thread waiting for 10000 ms
download thread waiting for 10000 ms

In my case, rather than devcontainer, i'm using Bubblewrap. Also, I'm mounting a local binary cache constructed with mkBinaryCache and trying to make my build use it as a substituter.

Steps To Reproduce

I put together a full repro here, which constructs a script that shows the problem: https://github.com/thomasjm/nix-deadlock-repro. All you have to do is

git clone git@github.com:thomasjm/nix-deadlock-repro.git
cd nix-deadlock-repro
nix run .#go

(If this succeeds the first time, maybe try it once or twice more and you should see the deadlock.)

Expected behavior

The Nix build should complete successfully and promptly.

Metadata

Everything is fixed in my repro flake. I'm using a static build of Nix 2.28.

Additional context

Issue #11249 said it was fixed by #11171, but I'm testing on the latest Nix and that solution is not fixing it for me.

Checklist


Add 👍 to issues you find important.

@thomasjm thomasjm added the bug label Apr 15, 2025
@NaN-git
Copy link
Contributor

NaN-git commented Apr 15, 2025

Has cores = 0 a special meaning in nix.conf? I can reproduce the issue with these settings, but I'm not sure whether the config is correct. If I set cores = 1, then the issue seems to disappear.

@thomasjm
Copy link
Contributor Author

From the docs:

The cores setting determines the value of NIX_BUILD_CORES. NIX_BUILD_CORES is equal to cores, unless cores equals 0, in which case NIX_BUILD_CORES will be the total number of cores in the system.

My intention with cores = 0 is to have Nix autodetect the number of cores. I wonder if something could be going wrong with that inside the bubblewrap container.

@thomasjm
Copy link
Contributor Author

I just tried cores = 1 and got the issue still. It's not always perfectly reproducible.

@thomasjm
Copy link
Contributor Author

CC @roberth who was involved in some similar issues like #11258

@thomasjm
Copy link
Contributor Author

Ah, I'm seeing it happen sometimes even without the Bubblewrap sandbox.

The common denominator seems to be that it gets stuck when using a local substituter, like --extra-substituters 'file://...'.

@roberth roberth added the fetching Networking with the outside (non-Nix) world, input locking label Apr 20, 2025
@roberth roberth added this to Nix team Apr 20, 2025
@github-project-automation github-project-automation bot moved this to To triage in Nix team Apr 20, 2025
@thomasjm
Copy link
Contributor Author

Update: it can get stuck with a local HTTP substituter too! I made a branch to try this variation: https://github.com/thomasjm/nix-deadlock-repro/tree/http. (See comparison).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fetching Networking with the outside (non-Nix) world, input locking
Projects
Status: To triage
Development

No branches or pull requests

3 participants