This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: HP-UX thread stack size needs to be increased
Type: behavior Stage: test needed
Components: Documentation Versions: Python 2.6
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: BreamoreBoy, asmodai, blade_doyle, loewis
Priority: low Keywords:

Created on 2005-12-13 20:22 by blade_doyle, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (7)
msg60845 - (view) Author: Blade (blade_doyle) Date: 2005-12-13 20:22
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.
msg60846 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-01-11 22:57
Logged In: YES 
user_id=21627

Can you provide a patch to configure.in that adds this
automatically?
msg60847 - (view) Author: Blade (blade_doyle) Date: 2006-01-11 23:42
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.
msg60848 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-01-12 05:40
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.
msg86492 - (view) Author: Jeroen Ruigrok van der Werven (asmodai) * (Python committer) Date: 2009-04-25 12:26
There has been no patch forthcoming in 3-4 years. Should the possibility
of a stack size increase for HP-UX be documented somewhere in the
installation/build documentation so that this issue can finally be
closed or do we want to fix configure for this?
msg114998 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-08-26 16:15
No reply to msg86492 so I'll close unless someone objects.
msg116163 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-09-12 10:23
No reply to msg114998.
History
Date User Action Args
2022-04-11 14:56:14adminsetgithub: 42689
2010-09-12 10:23:58BreamoreBoysetstatus: pending -> closed
resolution: out of date
messages: + msg116163
2010-08-26 16:15:08BreamoreBoysetstatus: open -> pending
nosy: + BreamoreBoy
messages: + msg114998

2009-04-25 12:26:59asmodaisetnosy: + asmodai
messages: + msg86492
2009-03-20 23:31:06ajaksu2setpriority: normal -> low
stage: test needed
type: behavior
versions: + Python 2.6
2005-12-13 20:22:25blade_doylecreate