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

B

bdoyle

[also sent to (e-mail address removed)]

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.
 
B

bdoyle

I finally figured this threading problem out. Soooo simple. The
thread
stack size needed to be increased....the default thread stack size on
hp-ux is insufficient.

I suggest that change be added to the default Python build process ...
or a note added to the README under the HP-UX section at least.


Now I see a 'gc' error and crash on program termination. I'll post
that
error message in a followup post (a new thread for a few topic).

Thanks,
Blade.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top