X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Fri, 10 Feb 2012 17:24:58 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: cygwin > 1.7.9: Segmentation faults / STATUS_STACK_OVERFLOW Message-ID: <20120210162458.GB4843@calimero.vinschen.de> Mail-Followup-To: cygwin AT cygwin DOT com References: <0C11C5BF0B29FD43A8D0250F711D497F89E1DD585C AT ex01-ubitronix DOT ubitronix DOT local> <20120207164548 DOT GD3178 AT calimero DOT vinschen DOT de> <0C11C5BF0B29FD43A8D0250F711D497F89E1DD5886 AT ex01-ubitronix DOT ubitronix DOT local> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <0C11C5BF0B29FD43A8D0250F711D497F89E1DD5886@ex01-ubitronix.ubitronix.local> User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Hi Manuel, please, don't http://cygwin.com/acronyms/#TOFU 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 this: > 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 -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple