im running gentoo linux primary on server systems. Sometimes single processes run crazy and eat up all memory. To prevent any bigger problems (as the kernel starts killing proccesses) im starting my daemons with a ulimit limitation of memory etc. It would be a nice feature to implement this ulimit limitation directly in the init runscript programm. The second nice feature would be multiple programm instances. Just like the net.eth0 and net.eth1 it would be nice to have things like mysql.config1 and mysql.config2 where mysql will not use the default config directory /etc/mysql but will use /etc/mysql.config1 ... . I wanted to write this ideas down so that someone interested could probably implement them (or if i have time later on i will do it myself), and so that thez are not forgotten)
(In reply to comment #0) > It would be a nice feature to implement this ulimit limitation directly in the > init runscript programm. What's wrong with /etc/security/limits.conf ? > Just like the net.eth0 and net.eth1 it would be nice to have things like > mysql.config1 and mysql.config2 where mysql will not use the default config > directory /etc/mysql but will use /etc/mysql.config1 ... . That's already implemented (in >=mysql-4.1 at least) - see /etc/conf.d/mysql and it's slots feature. Have I missed something?
as i understood it limits.conf maps to the user globaly and ulimit works on the running shell and all its subproccesses. Eg the example of using mysql with 2 instances you can limit it with the limits.conf only for both together, not for each one seperat.
i forgot another more important thing. Eq apache is running its master process as root (and forks its clients as another user) So apache has the limits of the root user not the apache user. using ulimit you can set limits for apache too.
No idea how you'd like to solve this on baselayout level. If you are suggesting a solution on per-package basis, then a summary bug won't work...
Well nearly every package has a /etc/conf.d/file entry shouldn it be posible to set there a parameter ULIMIT_MEMORY which when set it will be used to activate a ulimit in the start routine??
this bug only covers the first request mentioned in the original comment i dont think this should be too hard to implement ...
Created attachment 78073 [details, diff] Allows each service to specify RC_ULIMIT Here's a quick patch that enables RC_ULIMIT support on a global basis or a per-service basis for baselayout-1.12.0_pre15-r1. It seems to work fine and I've applied it to our svn - will be in baselayout-1.12.0_pre16 unless anyone finds anything wrong with it and posts back here.
pre16 is out