From 9e38b7b0fb88a7ce82749d9ebcdeb3133fc371c8 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Fri, 16 Feb 2024 23:14:39 +0000 Subject: [PATCH] pkgsi686Linux.samba: don't configure `waf` in parallel on 32-bit systems Without the change `waf configure` hung on `i686Linux.samba` on systems with large amount of host CPUs (for me it's 16). This happens because one of the worker processes gets `-ENOMEM` and does not recover from it: 2084476 mmap2(NULL, 8392704, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = -1 ENOMEM (Cannot allocate memory) 2084476 munmap(0xf2b5c000, 16384) = 0 2084476 rt_sigprocmask(SIG_BLOCK, ~[RT_1], NULL, 8) = 0 2084476 madvise(0x1ff000, 8372224, MADV_DONTNEED) = 0 2084476 exit(0) = ? 2084476 +++ exited with 0 +++ THe change extends 32-bit arm workaround to limit to one thread to all 32-bit systems. --- pkgs/servers/samba/4.x.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/samba/4.x.nix b/pkgs/servers/samba/4.x.nix index fda0649de220..9e4beaa0586b 100644 --- a/pkgs/servers/samba/4.x.nix +++ b/pkgs/servers/samba/4.x.nix @@ -165,8 +165,14 @@ stdenv.mkDerivation rec { ++ optional (!enablePam) "--without-pam" ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "--bundled-libraries=!asn1_compile,!compile_et" - ] ++ optionals stdenv.isAarch32 [ - # https://bugs.gentoo.org/683148 + ] ++ optionals stdenv.buildPlatform.is32bit [ + # By default `waf configure` spawns as many as available CPUs. On + # 32-bit systems with many CPUs (like `i686` chroot on `x86_64` + # kernel) it can easily exhaust 32-bit address space and hang up: + # https://github.com/NixOS/nixpkgs/issues/287339#issuecomment-1949462057 + # https://bugs.gentoo.org/683148 + # Limit the job count down to the minimal on system with limited address + # space. "--jobs 1" ];