Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Wait for build users when none are available #3564
Descriptions from there:
Additional implementation details: when build users are available, the behavior is exactly the same as before (choose the first available user, take a lock on it, use it). However, when no build users are available at the moment, repeat the search every two seconds. Whenever a build user becomes available, choose it and continue as usual. Previous behavior was to error out.
This is not a good solution because it puts the entire build loop to sleep (since it's single-threaded). So no other builds/substitutions will make any progress until another process releases a build user. In fact, it seems that this will deadlock if this process itself has acquired all build users (since then it can't make progress to release any build users).
For comparison, if we can't acquire a lock on an output path, the
My testing methodology, for anyone interested:
If the last two commands succeed and use up all available build users while not crashing and not using users two times over, my patch is correct.
I'd be very grateful if someone tested this and reported the results on non-NixOS linux and/or Mac.