Subject: bug#42371: Grafts max out build slots without being queued

From: zimoun <[email-masked]>
Date: Fri, 17 Jul 2020 11:23:04 +0200

Hi Maxim,

> --8<---------------cut here---------------start------------->8---
> guix build --quiet --check $(guix package -A | head -n 11 | cut -f1)

[...]

> guix build: error: all build users are currently in use; consider creating additional users and adding them to the `guixbuild' group
> --8<---------------cut here---------------end--------------->8---

In my case, it starts to download substitutes (but I have remove
--quiet), something like:

--8<---------------cut here---------------start------------->8---
substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0%       
11.3 MB will be downloaded:                                                     
   /gnu/store/…-jansson-2.12                                                    
   /gnu/store/…-jemalloc-5.2.1                                                  
   /gnu/store/…-libev-4.31                                                      
   /gnu/store/…-glibc-2.31                                                      
   /gnu/store/…-glibc-2.31-static                                               
   /gnu/store/…-c-ares-1.16.0                                                   
   /gnu/store/…-nghttp2-1.41.0-lib                                              
   /gnu/store/…-nghttp2-1.41.0                                                  
substituting /gnu/store/…-c-ares-1.16.0...                                      
downloading from https://ci.guix.gnu.org/nar/lzip/84hjhzjypgp5pgh6r5y7m561lk625\
pn0-c-ares-1.16.0 ...                                                           
 c-ares-1.16.0  123KiB               1.6MiB/s 00:00 [##################] 100.0% 
                                                                                
substituting /gnu/store/…-jansson-2.12...                                       
downloading from https://ci.guix.gnu.org/nar/lzip/v5rgf8v6cjxjbngkzjcznj98dkxj8\
svg-jansson-2.12 ...                                                            
 jansson-2.12  27KiB                 4.3MiB/s 00:00 [##################] 100.0% 
[…]
13.2 MB will be downloaded:                                                     
   /gnu/store/…-cyrus-sasl-2.1.27                                               
   /gnu/store/…-glibc-2.31                                                      
   /gnu/store/…-glibc-2.31-static                                               
   /gnu/store/…-gnutls-3.6.12                                                   
   /gnu/store/…-openldap-2.4.50                                                 
substituting /gnu/store/…-cyrus-sasl-2.1.27...                                  
downloading from https://ci.guix.gnu.org/nar/lzip/xp8545c74xkkj12q41d1zl5wngb47\
7gj-cyrus-sasl-2.1.27 ...                                                       
 cyrus-sasl-2.1.27  234K
[…]                                                                             
28.0 MB will be downloaded:                                                     
   /gnu/store/…-pcre-8.44-bin                                                   
   /gnu/store/…-pcre-8.44                                                       
   /gnu/store/…-mpfr-4.0.2                                                      
   /gnu/store/…-rasqal-0.9.33                                                   
   /gnu/store/…-libxslt-1.1.34                                                  
   /gnu/store/…-raptor2-2.0.15                                                  
   /gnu/store/…-glib-2.62.6                                                     
   /gnu/store/…-dbus-1.12.16                                                    
   /gnu/store/…-glib-2.62.6-bin                                                 
   /gnu/store/…-glib-2.62.6                                                     
   /gnu/store/…-avahi-0.8                                                       
   /gnu/store/…-4store-1.1.6                                                    
   /gnu/store/…-a2ps-4.14
   /gnu/store/…-mesa-20.0.8-bin                                                 
   /gnu/store/…-mesa-20.0.8      
[…]   
The following derivations will be built:                                        
   /gnu/store/…-abbaye-2.0.1.drv                                                
   /gnu/store/…-sdl-union-1.2.15.drv                                            
   /gnu/store/…-0ad-0.0.23b-alpha.drv                                           
899.1 MB will be downloaded:                                                    
   /gnu/store/…-libsodium-1.0.18                                                
   /gnu/store/…-mozjs-38.2.1.rc0
[…]
   /gnu/store/…-ed-1.16                                                         
   /gnu/store/…-patch-2.7.6                                                     
   /gnu/store/…-diffutils-3.7
[…]
successfully built /gnu/store/…-sdl-union-1.2.15.drv                            
building /gnu/store/…-0ad-0.0.23b-alpha.drv...                                  
WARNING: (guile-user): imported module (guix build utils) overrides core bindin\
g `delete'                                                                      
starting phase `set-SOURCE-DATE-EPOCH'                                          
phase `set-SOURCE-DATE-EPOCH' succeeded after 0.0 seconds                       
starting phase `set-paths'                                                      
environment variable `PATH' …
[…]
--8<---------------cut here---------------end--------------->8---

And I even tried with "-n21" and it seems ok.

I am running Guix on the top of Debian with ext4.

> The key is passing more than 10 packages (I have 10 build users) as an
> argument when using the '--check' argument.

Well, I am not sure to understand, but in nix/libstore/build.cc,
"void UserLock::acquire()", there is:

--8<---------------cut here---------------start------------->8---
    foreach (Strings::iterator, i, users) {
[…]
        if (lockFile(fd, ltWrite, false)) {
[…]
            return;
        }
    }

    throw Error(format("all build users are currently in use; "
        "consider creating additional users and adding them to the `%1%' group")
        % settings.buildUsersGroup);
--8<---------------cut here---------------end--------------->8---

So maybe the file is locked for whatever other reason on your machine?

All the best,
simon