[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!
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
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.
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.