Ed Donahue
2008-Jul-23 18:36 UTC
[CentOS] prevent runaway PID taking down server (RAM/swap)
Is there a way I can prevent processes from taking up all the ram then swap until the box crashes/freezes? I'm using IEs4Linux and the wineserver seems to start taking up RAM until my box dies, it happens slowly. I am able to kill the sucker now, but I'd like to not have to worry about that. sar -r 01:00:01 PM kbmemfree kbmemused %memused kbbuffers kbcached kbswpfree kbswpused %swpused kbswpcad 01:10:01 PM 5812 949580 99.39 5560 67688 189912 1841696 90.65 33300 01:20:01 PM 4736 950656 99.50 4832 119364 0 2031608 100.00 46104 01:30:02 PM 8788 946604 99.08 1004 32360 4 2031604 100.00 10672 01:52:50 PM LINUX RESTART -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.centos.org/pipermail/centos/attachments/20080723/fc52896f/attachment-0001.html>
Nifty Cluster Mitch
2008-Jul-23 19:05 UTC
[CentOS] prevent runaway PID taking down server (RAM/swap)
On Wed, Jul 23, 2008 at 02:36:11PM -0400, Ed Donahue wrote:> Sender: centos-bounces at centos.org > > Is there a way I can prevent processes from taking up all the ram then > swap until the box crashes/freezes? > I'm using IEs4Linux and the wineserver seems to start taking up RAM > until my box dies, it happens slowly. > I am able to kill the sucker now, but I'd like to not have to worry > about that. > sar -r > 01:00:01 PM kbmemfree kbmemused %memused kbbuffers kbcached kbswpfree > kbswpused %swpused kbswpcad > 01:10:01 PM 5812 949580 99.39 5560 > 67688 189912 1841696 90.65 33300 > 01:20:01 PM 4736 950656 99.50 4832 > 119364 0 2031608 100.00 46104 > 01:30:02 PM 8788 946604 99.08 1004 > 32360 4 2031604 100.00 10672 > 01:52:50 PM LINUX RESTARTIf wineserver has no hook for limiting its own footprint add a ulimit to the startup script or use a wrapper with one. Look at ulimit -a for all the limits and the man page. There are multiple shared commons resources that may apply. core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 20463 max locked memory (kbytes, -l) 32 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 10240 cpu time (seconds, -t) unlimited max user processes (-u) 20463 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited You can check limits on a running process too. $ cat /proc/29906/limits Limit Soft Limit Hard Limit Units Max cpu time unlimited unlimited ms Max file size unlimited unlimited bytes Max data size unlimited unlimited bytes Max stack size 10485760 unlimited bytes Max core file size 0 unlimited bytes Max resident set unlimited unlimited bytes Max processes 20463 20463 processes Max open files 1024 1024 files Max locked memory 32768 32768 bytes Max address space unlimited unlimited bytes Max file locks unlimited unlimited locks Max pending signals 20463 20463 signals Max msgqueue size 819200 819200 bytes Max nice priority 0 0 Max realtime priority 0 0 Max realtime timeout unlimited unlimited us -- T o m M i t c h e l l Looking for a place to hang my hat :-(
William L. Maltby
2008-Jul-23 19:13 UTC
[CentOS] prevent runaway PID taking down server (RAM/swap)
On Wed, 2008-07-23 at 14:36 -0400, Ed Donahue wrote:> Is there a way I can prevent processes from taking up all the ram then > swap until the box crashes/freezes?If the process is started from bash, whther by hand or script, I would think that bash's "ulimit" builtin would give what you need? "man bash", /ulimit To prevent a process from running wild, it would have to be non-root user I guess.> > I'm using IEs4Linux and the wineserver seems to start taking up RAM > until my box dies, it happens slowly. > > <snip>-- Bill