Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian User (http://www.linux-archive.org/debian-user/)
-   -   Runaway process detection. (http://www.linux-archive.org/debian-user/494995-runaway-process-detection.html)

Dan Serban 02-27-2011 11:23 PM

Runaway process detection.
 
I've run into a bit of a problem that I'd like to tackle:

I'm running lenny in an appserver setup with ltsp. Everything works dandy,
and until I have tested the upgrade path to squeeze (possible x.org issues)
I'd like to tackle an annoying problem I keep running into.

Because of a bug in gtk, iceweasel and others (google helped me
find the bug reports) nautilus for some users pegs at 100% cpu use
because .xsession-errors fills up at incredible rates, which in turn
basically hangs the machine (nautilus ends up using over 40 gigs of
memory).

I can't kill the parent as it'll bring everyone's desktop down and...
that's even worse.

So I'd like to detect the one _child_ process that is causing this,
and killing it. Problem with this is that monit/mon/ps-watcher all
seem to hinge on the parent, and I can't simply detect the one child
that's hogging so much IO and killing it.

Do any of you have any suggestions on how I can approach this and
stop the phone calls of insanity with silly comments added such as "windows
wouldn't do this" crap, which being a zealot utterly insults me :).


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20110227162337.5102a393@ws82.int.tlc">http://lists.debian.org/20110227162337.5102a393@ws82.int.tlc

Dan Serban 02-28-2011 08:23 PM

Runaway process detection.
 
On Sun, 27 Feb 2011 16:23:37 -0800
Dan Serban <dserban@lodgingcompany.com> wrote:

> Because of a bug in gtk, iceweasel and others (google helped me
> find the bug reports) nautilus for some users pegs at 100% cpu use
> because .xsession-errors fills up at incredible rates, which in turn
> basically hangs the machine (nautilus ends up using over 40 gigs of
> memory).
>
> I can't kill the parent as it'll bring everyone's desktop down and...
> that's even worse.

To answer my own question, I came up with the following:

ps h -C nautilus -o pid,pmem,user|while read -r progpid pcntmem puser; do
if (( $(bc <<< "$pcntmem > 10") )); then
kill -15 $progpid
echo ' > /home/$puser/.xession-errors
fi
done

The above is run every minute via cron. Thought I'd share with the
community in case anyone else ran into the same type of problem.

To explain the above, ps simply returns any processes of which the command
contains nautlius with pid, percentage memory, user. If the percentage
memory is above 10% (bc is used to deal with floating point numbers) then
kill the process.

I've done a lot of googling and couldn't find anything that would handle
child processes so I had to piece this together.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20110228132326.783ea823@ws82.int.tlc">http://lists.debian.org/20110228132326.783ea823@ws82.int.tlc

Hugo Vanwoerkom 03-01-2011 03:20 PM

Runaway process detection.
 
Dan Serban wrote:

On Sun, 27 Feb 2011 16:23:37 -0800
Dan Serban <dserban@lodgingcompany.com> wrote:


Because of a bug in gtk, iceweasel and others (google helped me
find the bug reports) nautilus for some users pegs at 100% cpu use
because .xsession-errors fills up at incredible rates, which in turn
basically hangs the machine (nautilus ends up using over 40 gigs of
memory).

I can't kill the parent as it'll bring everyone's desktop down and...
that's even worse.


To answer my own question, I came up with the following:

ps h -C nautilus -o pid,pmem,user|while read -r progpid pcntmem puser; do
if (( $(bc <<< "$pcntmem > 10") )); then
kill -15 $progpid
echo ' > /home/$puser/.xession-errors
fi
done

The above is run every minute via cron. Thought I'd share with the
community in case anyone else ran into the same type of problem.

To explain the above, ps simply returns any processes of which the command
contains nautlius with pid, percentage memory, user. If the percentage
memory is above 10% (bc is used to deal with floating point numbers) then
kill the process.

I've done a lot of googling and couldn't find anything that would handle
child processes so I had to piece this together.




Could you post when you find it worked?

Hugo


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: ikj6bm$rtf$1@dough.gmane.org">http://lists.debian.org/ikj6bm$rtf$1@dough.gmane.org


All times are GMT. The time now is 01:11 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.