about summary refs log tree commit diff
path: root/pkgs/servers/samba
diff options
context:
space:
mode:
authorSergei Trofimovich <slyich@gmail.com>2024-02-16 23:14:39 +0000
committerSergei Trofimovich <slyich@gmail.com>2024-02-16 23:14:39 +0000
commit9e38b7b0fb88a7ce82749d9ebcdeb3133fc371c8 (patch)
tree2a6ae4c571f2dcf5b0d7ea3a234abf57c10c362c /pkgs/servers/samba
parent571716ebcaed3c90636b6bfe886bb1145bbd0344 (diff)
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.
Diffstat (limited to 'pkgs/servers/samba')
-rw-r--r--pkgs/servers/samba/4.x.nix10
1 files changed, 8 insertions, 2 deletions
diff --git a/pkgs/servers/samba/4.x.nix b/pkgs/servers/samba/4.x.nix
index fda0649de2204..9e4beaa0586b9 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"
   ];