handy tip #502
Steven M. Kramer
smk at linus.UUCP
Wed Aug 3 01:13:30 AEST 1983
A user has this program:
main() {while(1) fork();}
On USG, you are doomed. There is no way to kill it. On 4.1, the job
control comes to the rescue. In 4.1, only 25 jobs may appear per user
(except root, who shouldn't be this stupid). After 25 of these are
running, the fork() returns -1 on all of them, eating up CPU cycles
like mad. Killing one of them just means one of the processes will
be able to fork(), most likely before you can kill another one.
What to do??
Send a STOP signal to all the offending processes and then kill -9 them.
Once suspended, you won't be racing against time to kill off every one.
If you ARE the user who did this, you can't create a ps to
see what the process IDs are. No fork()s will be allowed. What you CAN
do is exec ps from the shell you are on and record the process ids.
After done, ps will kick you off (the shell is gone). Then log in again
(the setuid root process doesn't check on max number of processes).
Your .profile or .login file won't work correctly if it has non-builtin
commands in it, but that's OK. Once logged in, have the shell STOP the
processes as above and kill them.
This came up recently on 2 systems here. I thought of this
after-the-fact and thought I could share this. (I hear dmartindale at watmath
thought of the second thing also.)
--
--steve kramer
{allegra,genrad,ihnp4,utzoo,philabs,uw-beaver}!linus!smk (UUCP)
linus!smk at mitre-bedford (ARPA)
More information about the Comp.unix.wizards
mailing list