29 points · by Bender · 6y ago · 36 comments
I don't know if I'm a systemd fan (yeah, I'm not), but there's nothing wrong with having more than 32K PIDs. At all. If your software breaks, it's stupid and broken and needs to be fixed.
Distributions using systemd may still change the default if they wish.
Note that this is exactly the reason why anything Lennart does is met with vitriol. He can’t keep his hands out of the cookie jar and when challenged, he and his supporters bring on the excuses. It is not for Lennart or his supporters to decide what’s better for me. That’s for the distributors to decide. Systemd does not get to decide preferences and neither does it get to set defaults.
There is procfd's nowadays that let you have a consistent handle on a specific process, but it doesn't solve the problem for anything that looks at PIDs.
It also naturally limits you to hosting only 32K processes; my browser at work consumes almost 1000 PIDs mainly via a lot of threads running at the same time. At home where I have even more tabs open, it's likely that it is getting close to 5000 threads running. Of those 32K processes, only 27k remain, which is a significant chunk.
I believe PID is a bit of a dated way to refer to processes and ultimately we should move to opaque process handles (like procfd).
One could make a collection of bugs that are revealed by (quite normal) process ID re-use. One of particular note in this context is the bug that occurs when one is using Linux control groups in lieu of proper job objects (which Linux does not have) and trying to do what on an actual first-class job object would be a "terminate all processes in this job" system call.
* http://jdebp.uk./FGA/linux-control-groups-are-not-jobs.html
What this made me realize, is that because I do this so little overtly, I hadn't even considered it a high risk. I do have pids in files: /var/run/nginx.pid style. They aren't fixed width fields.
Top and the like may mis-display on a wide pid I guess, unless its set to use some truncating field but then you get a problem of mis-attributing the PID value to the truncated value, cut/paste.. BOOM
"1500 bytes of payload"