Michael C. Toren on 28 Sep 2006 16:17:48 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Redhat EL3 and ulimit


On Mon, Sep 25, 2006 at 01:55:59PM -0400, Michael Bevilacqua wrote:
> Zope on my RHEL3 server likes to use as much memory as possible. I
> would like to limit the amount of memory it uses to 32M. So within
> /etc/security/limits.conf I added the following:
> 
> zope            hard    rss             32000
> @zope           hard    rss             32000
> 
> and tested it:
> 
> [root@server1 root]# su -l zope
> -bash-2.05b$ ulimit -a | grep "max memory"
> max memory size       (kbytes, -m) 32000

I don't run zope myself so I can't say with certainly, but it sounds like
the problem you're running into is that the limits.conf file will only
come into play when PAM is involved in changing your UID.  For example,
when you run su, the changes you made to your limits.conf work because
you likely have a line in your /etc/pam.d/su file that looks like:

	session    required   pam_limits.so

However, PAM isn't always involved when changing the UID -- for instance,
when calling the setuid(2) system call.  So, depending on how zope is
being started by your init scripts, the limits.conf file may not be
consulted.

You have a few alternatives at your disposal.  One would be to use djb's
softlimit utility (http://cr.yp.to/daemontools/softlimit.html), which is
bundled with his daemontools package.  Another would be to wrap your zope
startup routine in a shell script which makes calls to ulimit before
execing zope.

HTH,
-mct
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug