bug-make
[Top][All Lists]
Advanced

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

[bug #18396] stack size setrlimit call interacts badly with Solaris/x86


From: Gabor Melis
Subject: [bug #18396] stack size setrlimit call interacts badly with Solaris/x86 kernel bug
Date: Fri, 29 Jun 2012 08:55:00 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5

Follow-up Comment #6, bug #18396 (project make):

I've been recently caught out by setrlimit. I believe what happened is that
pthread_create (in a child process) stack size default is on linux calculated
from the stack limit. 


>From the pthread_create man page:

       On Linux/x86-32, the default stack size for a new thread is 2
megabytes.
       Under the NPTL threading implementation, if the RLIMIT_STACK soft
resource
       limit at the time the program started has any value other than
"unlimited",
       then it determines the default stack size of new threads.

If we start a program that calls pthread_create from the shell that has a soft
limit of 8192k and no hard limit, then the new thread will get a 8192k stack.
If the same program is started from make, then it will get a stack of 2048k
because make removes the soft limit.

I understand that calling pthread_create without setting the stack size is not
recommended and that the defaulting mechanism is suspect. Still, it's
surprising to find that make mucks with the limits.

A way out could be to actually restore the limits before the child is exec'ed
although that may not be legal or run into problems if the stack is in fact
deeper than the original limit.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?18396>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]