From owner-freebsd-hackers@FreeBSD.ORG Sun May 25 15:58:28 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D2FED37B401; Sun, 25 May 2003 15:58:28 -0700 (PDT) Received: from posgate.acis.com.au (posgate.acis.com.au [203.14.230.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 95FDB43FAF; Sun, 25 May 2003 15:58:26 -0700 (PDT) (envelope-from andymac@bullseye.apana.org.au) Received: from bullseye.apana.org.au (dialup-1.aaa.net.au [203.14.230.66]) by posgate.acis.com.au (8.12.7/8.12.7) with ESMTP id h4PMwHGk006095; Mon, 26 May 2003 08:58:18 +1000 Received: from bullseye.apana.org.au (localhost.apana.org.au [127.0.0.1]) h4PMvV19057788; Mon, 26 May 2003 08:57:31 +1000 (EST) (envelope-from andymac@bullseye.apana.org.au) Received: from localhost (andymac@localhost)h4PMvVcQ057785; Mon, 26 May 2003 08:57:31 +1000 (EST) (envelope-from andymac@bullseye.apana.org.au) Date: Mon, 26 May 2003 08:57:31 +1000 (EST) From: Andrew MacIntyre To: Daniel Eischen In-Reply-To: Message-ID: <20030526084710.A57768@bullseye.apana.org.au> References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.30 (www . roaringpenguin . com / mimedefang) cc: freebsd-hackers@freebsd.org cc: alane@freebsd.org Subject: Re: setting stacksize in "initial" thread (pthreads, 4.8R) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 May 2003 22:58:29 -0000 On Sun, 25 May 2003, Daniel Eischen wrote: > On Sun, 25 May 2003, Andrew MacIntyre wrote: > > > I have a situation with a Python interpreter built from Python > > CVS sources that is hitting the stack limit for the "initial" thread > > imposed by libc_r: PTHREAD_STACK_INITIAL in > > /usr/src/lib/libc_r/uthread/pthread_private.h is set to 1MB (0x100000). {...} > Is this something that is common to all python scripts, or is > it just your own script(s) that is(are) getting caught. It > seems 1MB is an awful lot to be on the stack, and perhaps some > things are better malloc'd. The problem actually occurs with recursive matches in Python's regex engine. Python has a hardcoded regex recursion limit, which has trapped ballistic matches before running out of the default stack. However a couple of recent fixes to the regex engine have increased stack consumption, and the hard limit has to be lowered. The failures are being exhibited by the Python regex engine regression tests. Compiler optimisation plays a role here:- - gcc 2.95: -O3 hits the stack limit, -O2 doesn't; - gcc 3.2.2: -Os is the only optimisation setting that doesn't hit the stack limit. (these all with the default regex recursion depth). I was hoping there was a way to avoid FreeBSD having a recursion limit lower than any other OS in the presence of threads, but your response indicates there isn't - at least using libc_r. Using the Linuxthreads port instead of libc_r works fine. -- Andrew I MacIntyre "These thoughts are mine alone..." E-mail: andymac@bullseye.apana.org.au (pref) | Snail: PO Box 370 andymac@pcug.org.au (alt) | Belconnen ACT 2616 Web: http://www.andymac.org/ | Australia