[Python-bugs-list] [ python-Bugs-507442 ] Thread-Support don't work with HP-UX 11

noreply@sourceforge.net noreply@sourceforge.net
Sun, 03 Nov 2002 13:09:34 -0800


Bugs item #507442, was opened at 2002-01-23 05:13
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=507442&group_id=5470

Category: Installation
Group: Python 2.1.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Stefan Walder (stefanwalder)
Assigned to: Neal Norwitz (nnorwitz)
Summary: Thread-Support don't work with HP-UX 11

Initial Comment:
Hi,

I've compiled Python 2.1.2 with the HP Ansi C-Compiler.
I've used ./configure --with-threads 
and added -D_REENTRANT to the Makefile. But the 
test_thread.py don't work!

[ek14] % ../../python test_thread.py
creating task 1
Traceback (most recent call last):
  File "test_thread.py", line 46, in ?
    newtask()
  File "test_thread.py", line 41, in newtask
    thread.start_new_thread(task, (next_ident,))
thread.error: can't start new thread

[ek14] %

Any idea?
More informations?

Thanks
Stefan Walder


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

>Comment By: Neal Norwitz (nnorwitz)
Date: 2002-11-03 16:09

Message:
Logged In: YES 
user_id=33168

I've built python 2.3 --with-threads, with the HP cc (-Ae),
modified Makefile to add -D_REENTRANT (although it was
already in pyconfig.h).  I did
this on the Compaq test drive machine: 
spe169.testdrive.compaq.com.  It is HP-UX 11i on rp2470 PA
RISC w/2 CPUs.  There are some test problems:
  * test_nis crashes the interpreter (I need to look into this)
  * test_tempfile fails due to too many open files
     - the problem is that __del__ tries to delete self.fd
        which doesn't exist
  * test_pwd fails w/wrong output:
- caught expected exception
+ fakeuid 4127 did not except pwd.getpwuid()

Just running test_thread.py works for me.  Is it possible to
disable threads at the OS level in HPUX?  Can threads be
used from C on this platform?

I will try 2.2.2 next.  I will also try on the snake farm,
but that is gcc.

Stefan, do you have this problem with python 2.2.2?  Are you
still having this problem?

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

Comment By: Martin v. Löwis (loewis)
Date: 2002-11-03 03:08

Message:
Logged In: YES 
user_id=21627

Neal, can you try to reproduce this?

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

Comment By: Martin v. Löwis (loewis)
Date: 2002-09-22 05:20

Message:
Logged In: YES 
user_id=21627

Any news on this? Can you please try Python 2.2 and report
how that works?

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

Comment By: Anthony Baxter (anthonybaxter)
Date: 2002-02-13 19:04

Message:
Logged In: YES 
user_id=29957

Unless someone with 
a) fairly deep knowledge of HP/UX, 
b) access to a HP/UX machine
and
c) the spare time and effort to debug this
steps forward, the chances of this being 
fixed are zero. 
(I still think adding a resolution of 'HP/UX' 
to the bug tracker would allow us to close a 
whooole lotta bugs)



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

Comment By: Martin v. Löwis (loewis)
Date: 2002-02-12 20:45

Message:
Logged In: YES 
user_id=21627

This problem looks very much like a HP-UX bug. It crashes
inside the malloc implementation, and not only that: it also
crashes inside the thread mutex used by malloc. I would
guess there is nothing we can do about this; please ask HP
for advise (or just don't use threads if they don't work)


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

Comment By: Stefan Walder (stefanwalder)
Date: 2002-02-12 15:08

Message:
Logged In: YES 
user_id=436029

Hi,

I've thought threads now work! But I think they don't!
I use python 2.1.2 with Zope. Now sometimes it works. But 
when i add a CMF-Object I get a core dump. So I've 
startetd gdb and here is the log:

jojo 22: gdb /opt/zope/bin/python2.1 core
HP gdb 2.0
Copyright 1986 - 1999 Free Software Foundation, Inc.
Hewlett-Packard Wildebeest 2.0 (based on GDB 
4.17-hpwdb-980821)
Wildebeest is free software, covered by the GNU General 
Public License, and
you are welcome to change it and/or distribute copies of 
it under certain
conditions.  Type "show copying" to see the conditions.  
There is
absolutely no warranty for Wildebeest.  Type "show 
warranty" for details.
Wildebeest was built for PA-RISC 1.1 or 2.0 (narrow), 
HP-UX 11.00.
..
Core was generated by `python2.1'.
Program terminated with signal 10, Bus error.

warning: The shared libraries were not privately mapped; 
setting a
breakpoint in a shared library will not work until you 
rerun the program.

#0  0xc2331920 in pthread_mutex_lock () from 
/usr/lib/libpthread.1
(gdb) bt
#0  0xc2331920 in pthread_mutex_lock () from 
/usr/lib/libpthread.1
#1  0xc0123ed0 in __thread_mutex_lock () from 
/usr/lib/libc.2
#2  0xc00a0018 in _sigfillset () from /usr/lib/libc.2
#3  0xc009e22c in _memset () from /usr/lib/libc.2
#4  0xc00a37d8 in malloc () from /usr/lib/libc.2
#5  0x3bad0 in PyFrame_New (tstate=0x0, code=0x0, 
globals=0x0, locals=0x0)
    at Objects/frameobject.c:149
#6  0xc0123f94 in __thread_mutex_unlock () from 
/usr/lib/libc.2
#7  <function called from gdb>
(gdb) 


I don't know if this is a python or zope Problem and I 
dont't know if this bug is at the right position. Please 
help.

Thanks
Stefan Walder



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

Comment By: Stefan Walder (stefanwalder)
Date: 2002-01-25 05:41

Message:
Logged In: YES 
user_id=436029

Fileupload config.h

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

Comment By: Stefan Walder (stefanwalder)
Date: 2002-01-25 05:36

Message:
Logged In: YES 
user_id=436029

Hi loewis,

I've uploaded the wanted files.
Next week I will test python 2.2. But I need python 2.1.2 
because I want to use Zope.

Thanks
Stefan Walder

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

Comment By: Martin v. Löwis (loewis)
Date: 2002-01-24 14:53

Message:
Logged In: YES 
user_id=21627

I can't check, but in theory, configure should (already,
atleast in 2.2):
1. detect to use pthreads on HP-UX
2. therefore, define _REENTRANT in pyconfig.h (config.h for 2.1)
3. automatically link with -lpthread

Stefan, can you please attach the (original, unmodified)
config.h, Makefile, and config.log to this report?

In Python 2.1, the test for pthreads failed, since
pthread_create is a macro, and the test failed to include
the proper header. This was fixed in configure.in 1.266. So:

Stefan, could you also try compiling Python 2.2 on your
system, and report whether the thread test case passes there?

This might be a duplicate of #416696, which would suggest
that properly detection of pthreads on HP-UX really is the cure.

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

Comment By: Nobody/Anonymous (nobody)
Date: 2002-01-24 09:34

Message:
Logged In: NO 

Anthony, if you want an entry on a bugs page for 2.1.2, its
no problem for me to create one. Please mail the exact text
that you want to appear there to describe this bug (or any
other bug in 2.1.2) to webmaster@python.org and I'll take
care of it.

--Guido (not logged in)

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

Comment By: Tim Peters (tim_one)
Date: 2002-01-24 04:38

Message:
Logged In: YES 
user_id=31435

I'm afraid threading on HP-UX never really works, no matter 
how many times users contribute config patches.  They get 
it to work on their box, we check it in, and the next 
release it starts all over again.  This has been going on 
for years and years.  If you think it suddenly started 
working in 2.2, wait a few months <wink>.

Note that the advice that you *may* have to use -
D_REENTRANT on HP-UX is recorded in Python's main README 
file; apparently this is necessary on some unknown proper 
subset of HP-UX boxes.

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

Comment By: Anthony Baxter (anthonybaxter)
Date: 2002-01-24 03:57

Message:
Logged In: YES 
user_id=29957

Hm. I'm not sure, either - but this could probably get 
an entry on the bugs page on creosote. Anyone? Is there a
"known issues" page somewhere?



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

Comment By: Stefan Walder (stefanwalder)
Date: 2002-01-24 02:59

Message:
Logged In: YES 
user_id=436029

Hi,

I've found a solution.
I've added a -D_REENTRANT to the CFLAGS and an 
-lpthread to the LIBS:

OPT=            -O -D_REENTRANT
DEFS=           -DHAVE_CONFIG_H
CFLAGS=         $(OPT) -I. -I$(srcdir)/Include $(DEFS)

LIBS=           -lnsl -ldld
LIBM=           -lm -lpthread
LIBC=
SYSLIBS=        $(LIBM) $(LIBC)

Now it works for me. But I don't have any idea to put this 
changes into the configure script.

mfG
Stefan Walder

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

Comment By: Anthony Baxter (anthonybaxter)
Date: 2002-01-23 10:22

Message:
Logged In: YES 
user_id=29957

Unfortunately, I don't have access to a HP/UX system, and I
couldn't find anyone during the process of doing 2.1.2 that
was willing to spend the time figuring out how and why 2.2's
threading finally started working on HP/UX. 

Without someone to do that, I'd say the chances of this ever
being addressed are close to zero. Does it work on 2.2?


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

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