This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cygwin > 1.7.9: Segmentation faults / STATUS_STACK_OVERFLOW

Hi Manuel,

please, don't  Thanks.

On Feb 10 13:40, Manuel Wienand wrote:
> Hi Corinna,
> ok, the STATUS_STACK_OVERFLOW problem is solved. Seems like a local variable with about 540 KiB caused the overflow. The Cygwin Shell gives me 2034 for "limit -s" Is that the correct maximum stack size in KiB that is relevant for me?

The default stacksize for the main thread is 2 Megs.  The default
stacksize of subsequently called pthreads is 512K.  In the below case
that's apparently not enough since the /proc/$PID/cmdline functionality
needs a lot of stack space.  The SEGV is a result of a stack overflow
again.  I can't tell why it only occurs under GDB, though.

However, I'm wondering if we should set the default stacksize for pthreads
to 1 Megs, as is the default for any other Windows thread...

Other than that, you can change the pthread stacksize since 1.7.10.  Try

> int main(void)
> {
>   int ret;
>   puts("Starting test");
> #if 0
>   // Working fine if called in the main thread.
>   callGlob(NULL);
> #else
>   // Not working if called in another thread.

    pthread_attr_t attr;
    pthread_attr_init (&attr);
    pthread_attr_setstacksize (&attr, 1024 * 1024);

>   ret = pthread_create(&threadId, NULL, callGlob, NULL);
>   [...]


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]