hp-ux crash: threading within a c++ module.

bdoyle at lsd25.net bdoyle at lsd25.net
Thu Dec 8 18:37:33 EST 2005


[also sent to python-help at python.org]

Hi Python Experts,


I am developing a Python interface to an existing (multithreaded) c++
api.  I have it working on several platforms (linux, solaris, irix,
windoze) but I am having a few problems with threading on hp-ux and aix
platforms.  Here is one of the problems I see.


% uname -a
HP-UX hpux1 B.11.11 U 9000/800 ...
% python -V
Python 2.4.2


My first problem was:  When I tried to import my shared library
(oopython.sl) as a python module HP-UX told be that it does not
support dynamic loading shared libraries that contain TLS (thread local
storage).  I managed to solve that by rebuilding the python compiler so
that it was linked with the pthread library.  As a result the pthread
library is "pre loaded" by the time I ">> import oopython".


Now, my problem is:  When I am running my multi-threading test I see a
crash.  The threads are being created in the c++ module.  Using python
2.3.4 the test hangs.  Using python 2.4.2 the test crashes when calling
gethostbyname().  The stack trace is long so I'll just put in the
interesting parts ... if you want more just ask:

#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


This same code is executed earlier in the test but with only 1 thread
running and it does not crash.

Any help would be much appreciated.  I have to solve this problem so
I'll be happy to try things and report back the results.
Thanks,
Blade.




More information about the Python-list mailing list