You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Eric Covener <co...@gmail.com> on 2009/03/31 16:52:54 UTC

ThreadStackSize quirk on Linux

I'm finding that when I try to reduce the stack size with
ThreadStackSize on recent linux systems, where ulimit -s is NOT
unlimited (but very large, 10240K) , ThreadStackSize fails to have any
effect (via pmap / ps -eFw).

When ulimit -s is unlimited, and the default is very large,
ThreadStackSize works. Has this always been the case? If so, I'd like
to document for Linux that you're best off heading straight to ulimit
/ limits.conf.

(I looked at RHEL4 and RHEL5 with recent maintenance)

-- 
Eric Covener
covener@gmail.com

Re: ThreadStackSize quirk on Linux

Posted by Niklas Edmundsson <ni...@acc.umu.se>.
On Tue, 31 Mar 2009, Eric Covener wrote:

> I'm finding that when I try to reduce the stack size with
> ThreadStackSize on recent linux systems, where ulimit -s is NOT
> unlimited (but very large, 10240K) , ThreadStackSize fails to have any
> effect (via pmap / ps -eFw).
>
> When ulimit -s is unlimited, and the default is very large,
> ThreadStackSize works. Has this always been the case? If so, I'd like
> to document for Linux that you're best off heading straight to ulimit
> / limits.conf.
>
> (I looked at RHEL4 and RHEL5 with recent maintenance)

Yes, a "feature" since the NPTL-stuff. So now we have the range of 
defaults from 4k (Solaris I think) to huge (Linux), makes for funny 
surprises when porting applications written on Linux that doesn't set 
the stacksize appropriately...

We have the following in all our httpd startup scripts (Ubuntu boxes, 
but it's the same issue):

# NPTL (modern Linux threads) defaults the thread stack size to the setting
# of your stack resource limit. The system-wide default for this is 8MB,
# which is waaay exaggerated when running httpd.
# 512kB should be more than enough (AIX manages on 96kB, Netware on 64kB).
ulimit -s 512

/Nikke
-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  Niklas Edmundsson, Admin @ {acc,hpc2n}.umu.se      |     nikke@acc.umu.se
---------------------------------------------------------------------------
  Luckily, I'm out of hairs to split!
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=