Re: Stack consumption in NPTL



On Mar 7, 1:39 am, Chetan <chetan...@xxxxxxxxx> wrote:

We have an application which creates multiple threads and has some
logging mechanism. We observed that the application crashes when
using
NPTL but works just fine with LinuxThreads.
The stack trace analysis revealed that the crash is due to smaller
stack size. We are setting the stack size to 16K through the program
using pthread_attr_setstacksize() function.
Increasing the stack size to 128K did not reproduce the crash. We are
trying to find out the difference in behavior between LinuxThreads
and
NPTL with respect to stack size, pthread_attr_setstacksize() etc.
Does
anyone know about this? What should be the stack size for the threads
in NPTL?

You really are wasting your time. Just stop setting the stack size so
low. Investigating when you can get away with invoking undefined
behavior and when you can't just isn't interesting. Nobody wants
programs that "might happen to" work.

Reduce your stack usage and leave the default stack size. Don't
allocate large objects on the stack and limit your call stack depths
to reasonable ones. (There are other good reasons to do these two
things as well, for example, there is no reliable way to indicate out-
of-memory when an allocation occurs on the stack.)

DS
.



Relevant Pages

  • Stack consumption in NPTL
    ... We observed that the application crashes when ... The stack trace analysis revealed that the crash is due to smaller ... NPTL with respect to stack size, ... void call_my_sprintf ...
    (comp.os.linux.development.apps)
  • Re: Stack Size in NPTL
    ... NPTL with respect to stack size, ... Now I seem to get the crash at different level of recursion for LT and ... For LinuxThreads, it crashes while making 16th recursive call. ...
    (comp.programming.threads)
  • Stack Size in NPTL
    ... The stack trace analysis revealed that the crash is due to smaller ... Increasing the stack size to 128K did not reproduce the crash. ... NPTL with respect to stack size, ... void call_my_sprintf ...
    (comp.programming.threads)
  • Re: controlling stack size in RHEL 3.0 pthreads
    ... smaller stack space. ... hardware designs in C++ for those of you familiar ... NPTL and LinuxThread's versions of pthreads? ... You probably have a bug in your program (or request illegal stack ...
    (comp.programming.threads)
  • Re: Stack consumption in NPTL
    ... NPTL but works just fine with LinuxThreads. ... The stack trace analysis revealed that the crash is due to smaller ... Increasing the stack size to 128K did not reproduce the crash. ... NPTL with respect to stack size, ...
    (comp.os.linux.development.apps)