Public bug reported:

uutils sort spawns one thread per CPU plus helpers even for trivial input,
and panics instead of degrading when thread creation fails with EAGAIN.
GNU sort keeps working with fewer threads in the same situation.

This breaks openvpn on Ubuntu 26.10: [email protected] sets TasksMax=20,
and /etc/openvpn/update-resolv-conf pipes through sort. On a 16-CPU machine
sort aborts, the script passes no DNS servers to resolvconf, resolvconf exits 1,
and openvpn exits with "Failed running command (--up/--down)".

journal:
  openvpn[14032]: thread 'main' (14032) panicked at 
/usr/src/rustc-1.97.1/library/std/src/thread/functions.rs:131:29:
  openvpn[14032]: failed to spawn thread: Os { code: 11, kind: WouldBlock, 
message: "Resource temporarily unavailable" }
  openvpn[14055]: No DNS servers specified, refusing operation.
  openvpn[14024]: WARNING: Failed running command (--up/--down): external 
program exited with error status: 1
  openvpn[14024]: Exiting due to fatal error

Reproducer (16 CPUs, no root needed):
  $ printf 'b\na\n' | systemd-run --user --scope -q -p TasksMax=17 sort
  thread 'main' panicked at .../std/src/thread/functions.rs:131:29:
  failed to spawn thread: Os { code: 11, kind: WouldBlock, message: "Resource 
temporarily unavailable" }
  Aborted (core dumped)

  TasksMax=16 and TasksMax=18 succeed; RAYON_NUM_THREADS=1 does not avoid it.
  The same pipeline with gnusort succeeds at any TasksMax.
  strace -f shows 17 clone3() calls for a two-line input.

Expected: sort falls back to fewer threads (or a single thread) when
thread creation fails, as GNU sort does.

Workaround: drop-in for [email protected] with TasksMax=infinity,
or install coreutils-from-gnu.

Versions:
  Ubuntu 26.10, kernel 7.3.0-9-generic
  rust-coreutils 0.12.0-1ubuntu2
  coreutils-from-uutils 2ubuntu1
  openvpn 2.7.7-1ubuntu1.1

ProblemType: Bug
DistroRelease: Ubuntu 26.10
Package: rust-coreutils 0.12.0-1ubuntu2
ProcVersionSignature: Ubuntu 7.3.0-9.9-generic 7.3.0-rc6
Uname: Linux 7.3.0-9-generic x86_64
ApportVersion: 2.36.0-0ubuntu1
Architecture: amd64
CasperMD5CheckResult: unknown
CurrentDesktop: ubuntu:GNOME
Date: Mon Oct 26 10:04:53 2026
SourcePackage: rust-coreutils
UpgradeStatus: Upgraded to stonking on 2026-10-15 (10 days ago)

** Affects: rust-coreutils (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug stonking wayland-session

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2172214

Title:
  sort panics with "failed to spawn thread" under a cgroup pids limit,
  breaks openvpn update-resolv-conf

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/rust-coreutils/+bug/2172214/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to