[SOLVED] Too many forks, pid got used, we're confused
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Looking at the mother and child pids in the output you posted it looks like and endless loop was started that ate all the available pid numbers the system has.
WARNING! The following example may crash your computer if executed.
:(){ :|:& };:
The above is a known Bash fork() bomb that can produce something similar.
Most of the time it is very hard to do anything useful after something like this happens (you won't be able to get any commands to execute).
Not much to go on, but maybe it clarifies the behaviour a bit.
BTW, posting something like '/bin/ps U 1000 xfo pid,ppid,uid,cmd --sort=ppid' (or 'pstree -Apuh `id -gn`') would provide more process info making things easier to read.
BTW, posting something like '/bin/ps U 1000 xfo pid,ppid,uid,cmd --sort=ppid' (or 'pstree -Apuh `id -gn`') would provide more process info making things easier to read.
Thanks for replying !
But during that incident I could barely manage to save this output on a text file, I couldn't do anything more as mouse clicks were not responding !!
I had to hard restart the computer, so I couldn't execute pstree !
Unless you remove your history during shut-down/boot it is still there the next time you boot up your machine......
The bash fork bomb I mentioned is just an example (it is fast! and you can probably do nothing of use any more within seconds if not faster) and I'm pretty sure that specific example wasn't the cause.
during that incident I could barely manage to save this output on a text file, I couldn't do anything more as mouse clicks were not responding !!
I had to hard restart the computer, so I couldn't execute pstree !
Understandable, yes. I'm only saying that with the right information it would be easier to find out what on your system caused it. Right now the only thing one can say is that applying ulimits is always good. You did apply those, right?
I'm pretty sure that specific example wasn't the cause.
I checked the history command, there was nothing suspicious.
Then I suddenly remembered that there was one more process opened by me and that was KDevelop ! I ran commands to compile our project there. There is a file named "Libtool" which needs to be modified each time ./configure runs other wise the system hangs !!
That time I must not have done the same resulting in system hanging.
I confirmed this behavior today by deliberately missing the above step in compilation and it resulted in the same behavior as yesterday !
And that fork bomb explanation was nice in the link, thanks for that.
Quote:
Originally Posted by unSpawn
Right now the only thing one can say is that applying ulimits is always good. You did apply those, right?
What are ulimits ? I really don't know ! Perhaps I should RTFM.
This tool (ulimit) will not necessarily stop the initial process, it will limit the use of resource for a user or a specific terminal.
The message you get (also mentioned in the link I gave) tells you that a limit is reached. And even though that specific terminal might become unresponsive, other terminals and the machine itself are not compromised by, in this example, a bash fork bomb.
You could compare it with making a building fire proof: You can have a blazing fire in one room (which is destroyed, most of the time) but the adjacent rooms and building itself survive.
If I set max user processes to 30 and execute the fork bomb I see this:
And, in this case, the process is gone as well. I do believe the termination depends a bit on which process creates the fork(s). I'm not sure, but I would understand if the following scenario where true: Process A forks a sub-process B. Process B starts forking multiple processes (loop, intentional or not). Ulimit kills Process B and its children when reaching the limit, but process A remains.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.