[Bug 1867949] Re: It's time to increase the default pid_max from 32768 to avoid PID wraparounds/collossions
Trent Lloyd
1867949 at bugs.launchpad.net
Wed Sep 7 08:34:49 UTC 2022
This happens now on Jammy (22.04) on 64-bit (not on 32-bit due to system
limits)
systemd ships a default /usr/lib/sysctl.d/50-pid-max.conf, as per upstream commit here:
https://github.com/systemd/systemd/pull/12226
** Changed in: procps (Ubuntu)
Status: New => Fix Released
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to procps in Ubuntu.
https://bugs.launchpad.net/bugs/1867949
Title:
It's time to increase the default pid_max from 32768 to avoid PID
wraparounds/collossions
Status in procps package in Ubuntu:
Fix Released
Bug description:
The kernel.pid_max sysctl defaults to 32768. This is a very historic
limit to provide compatibility with ancient binaries.
Moving on to the year 2020 multicore CPU:s for desktops, laptops and
servers is the standard, and together with PID randomization
wraparound happens rather quickly on many-core machines with lots of
activity. Wraparounds in itself is not a big issue, but there are
corner cases like scripts that checks if a PID is alive etc that run
into trouble if another process has started using the PID it expects,
scripts (erroneously) using PIDs for work/temporary files, etc.
To avoid problems within the lifetime of Ubuntu Focal, it's time to
increase kernel.pid_max by default in the distribution by including
tuning in a file in /etc/sysctl.d/
Our suggestion is to ship the following tuning by default:
# Make PID-rollover not happen as often.
# Default is 32768
kernel.pid_max = 999999
with the following motivation:
1) It achieves a 30-fold increase in the available number-space,
reducing the likelihood of PID wraparound/collisions.
2) It only adds one digit to the PID, so it's still possible to
remember a PID
3) Output in top, ps, etc is still nicely readable
3) We have used it for years on Ubuntu 14.04 and onwards, on 1000+
machines and with a wide array of commercial and scientific software
without any issues.
4) One could argue that it is a preventive security measure, there are
a lot of weirdly written scripts and software out there that behaves
badly upon PID reuse/collissions.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/procps/+bug/1867949/+subscriptions
More information about the foundations-bugs
mailing list