[ python-Bugs-1379804 ] HP-UX thread stack size needs to be increased

SourceForge.net noreply at sourceforge.net
Thu Jan 12 06:40:26 CET 2006


Bugs item #1379804, was opened at 2005-12-13 21:22
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1379804&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: Platform-specific
Status: Open
Resolution: None
Priority: 5
Submitted By: Blade (blade_doyle)
Assigned to: Nobody/Anonymous (nobody)
Summary: HP-UX thread stack size needs to be increased

Initial Comment:
On HP-UX the default thread stack size is
"insufficient" and probably needs to be increased if
threads are performing any heavy tasks.  Obviously, the
ideal size depends on you application but I find that
THREAD_STACK_SIZE=0x50000 works well for me.

Using the default thread stack size my multi-threading
tests were failing with a corrupt stack sometimes and
this stack trace other times:

#0  0x79db8c0c in _isspace+0x2d8 () from
/usr/lib/libnss_dns.1
#1  0x7aff62c4 in nss_search+0x28c () from /usr/lib/libc.2
#2  0x7af4d320 in __gethostbyname_r+0x140 () from
/usr/lib/libc.2
#3  0x7af4d4bc in gethostbyname+0x94 () from
/usr/lib/libc.2
#4  here, I am calling: gethostbyname("localhost")
[cut]
#23 0x7a8c49ac in OpSession::begin+0x1c0 ()
from /space/bdoyle/hprisc/lib/oopython.sl
#24 0x7aa42660 in PyCFunction_Call+0xc8 ()
from
/space/bdoyle/PythonBinding/Python-2.4.2/libpython2.4.sl
[cut]
#38 0x7aabbda0 in PyEval_CallObjectWithKeywords+0x1c4 ()
from
/space/bdoyle/PythonBinding/Python-2.4.2/libpython2.4.sl
#39 0x7ab17e8c in t_bootstrap+0xa0 ()
from
/space/bdoyle/PythonBinding/Python-2.4.2/libpython2.4.sl
#40 0x7ab6400c in __pthread_body+0x44 () from
/usr/lib/libpthread.1
#41 0x7ab6e29c in __pthread_start+0x14 () from
/usr/lib/libpthread.1


I tested both Python 2.3.4 and 2.4.2 and increased
stack size solves the probem on both.

I suggest that a note be added to the Python README
under the HP-UX section.  The note should suggest that
the "BASECFLAGS" environment variable be set to include
"-DTHREAD_STACK_SIZE=0x50000" prior to running
configure.  I dont know that 0x50000 is really the
ideal stack size.....

Blade.

----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2006-01-12 06:40

Message:
Logged In: YES 
user_id=21627

Python has a standard, cross-platform initial recursion
limit (sys.getrecursionlimit()). The stacksize should be
large enough to accommodate this recursion limit, or else
the initial recursionlimit should be decreased on the
platform to fit into the default stacksize.

If you increase sys.setrecursionlimit, you should be able to
overrun the processor stack with a recursive program, so you
can find out what recursion depth the standard stack supports.

----------------------------------------------------------------------

Comment By: Blade (blade_doyle)
Date: 2006-01-12 00:42

Message:
Logged In: YES 
user_id=1404264

I think I can generate that patch.  I'll give a try.  I
found the patch guidelines for the Python project at
http://www.python.org/patches/  so that greatly increases my
chances of success!

One concern that I have is with the stack size value of
"0x50000".  I find that there is a wide range of default
stack sizes for the various operating systems.  There does
not seem to be any consensus on a good default value.  This
quote exemplifies the situation:

"On Tru64 UNIX, the default thread stack size increased from
24 KB to 5 MB in Version 5.0. On HP-UX, it is only 64 KB on
PA systems and 256 KB on Itanium®-based systems."

Quote From:
http://devrsrc1.external.hp.com/STKT/impacts/i375.html

How can I settle on a stacksize for this patch?  Unless
there are other suggestions I'll stick with "0x50000"
because I have tested that and know it works for what I
consider an 'average' application.

Thanks,
Blade.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2006-01-11 23:57

Message:
Logged In: YES 
user_id=21627

Can you provide a patch to configure.in that adds this
automatically?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1379804&group_id=5470


More information about the Python-bugs-list mailing list