How do I kill a forkbomb process?

11

3

I started forkbomb from normal user account say - "user1" I'm running a script which says

killall -u user1

But it didn't fix the situation.

lakshmipathi

Posted 2010-07-28T13:22:03.223

Reputation: 299

Is resetting the power an option? – None – 2010-07-28T13:23:48.330

is there any other option? Though reboot solves this issue. But it's not permanent solution.thanks for answer – None – 2010-07-28T13:26:16.257

Answers

14

reboot the computer

if you can't, you could try:

killall -STOP -u user1
killall -KILL -u user1

If by "permanent solution", you mean preventing this happening again, well you can't really, but you can simply reduce the ulimit for the problem users and ignore them.

Colin Pickard

Posted 2010-07-28T13:22:03.223

Reputation: 6 774

1thanks setting ulimit is the permanent solution to prevent it. But killall -KILL also worked for me.thanks – lakshmipathi – 2010-07-28T13:34:58.117

4

while true; do killall -u user1; done

Wolph

Posted 2010-07-28T13:22:03.223

Reputation: 595

0

I agree with Colin's answer, but I would wrap the -STOP into a script and nice --20 to ensure that the kill script gets more cpu than the 1000s bombs running.

echo "while [ 1 ]; do killall -STOP bombprocess ; done" > killscript.sh

or

echo "while [ 1 ]; do killall -STOP -u userrunningthebomb ; done" > killscript.sh

then

nice --20 ./killscript.sh

and then, after all of them stop

killall -KILL bombprocess (You should be already able to use ps again at this point)

Roberto Rodriguez Alcala

Posted 2010-07-28T13:22:03.223

Reputation: 1