Mailing List Archive

HPUX and threads?
Is HPUX-11 thread support tested/implemented/whatnot?

This at least does not look promising..

# /opt/python/bin/python
pthread_mutex_init: Invalid argument
Memory fault(coredump)

(also tests failed with the same message, obviously)

Python without threads seems to work fine.

--
"I am Grey. I stand between the candle and the star.
We are Grey. We stand between the darkness and the light."
- B5
HPUX and threads? [ In reply to ]
Markus Stenberg <mstenber@cc.Helsinki.FI> writes:

>Is HPUX-11 thread support tested/implemented/whatnot?
Implemented - yes, tested - not in your environment (until now).

>This at least does not look promising..

># /opt/python/bin/python
>pthread_mutex_init: Invalid argument
>Memory fault(coredump)

OK, this is probably due to an incorrect guess about which version of
pthreads is being used.

If you look at the beginning of the source file Python/thread_pthread.h
you'll see a series of preprocessor tests, defining PY_PTHREAD_D4 and
friends.

It seems HPUX selects either Draft 4 or the final standard, based on whether
_DECTHREADS_ is defined. Try placing the following after the #endif

#if defined(PY_PTHREAD_D4)
#error PY_PTHREAD_D4
#elif defined(PY_PTHREAD_D6)
#error PY_PTHREAD_D6
#elif defined(PY_PTHREAD_D7)
#error PY_PTHREAD_D7
#else
#error PY_PTHREAD_STD
#endif

make clean and recompile. This will (hopefully) give you an error like:
In file included from thread.c:146:
thread_pthread.h:88: #error PY_PTHREAD_STD

which tells you which version was assumed. Then, try undefining the
assumed value, and replace it with the likely correct value.

So, if you get PY_PTHREAD_STD, then replace the code above with:
#undef PY_PTHREAD_STD
#define PY_PTHREAD_D4

then make clean; make

That will hopefully get you running. A more permanent solution requires
someone who knows the history of pthreads on HPUX.

Jon.
HPUX and threads? [ In reply to ]
[Markus Stenberg]
> Is HPUX-11 thread support tested/implemented/whatnot?

You may want to ask on the Thread-SIG if you don't get an answer here.

> This at least does not look promising..
>
> # /opt/python/bin/python
> pthread_mutex_init: Invalid argument
> Memory fault(coredump)
>
> (also tests failed with the same message, obviously)

Are you running pthreads? Python is sure trying to <wink>.

The msg is coming from line 263 of Python/thread_pthread.h. It means the
platform's

status = pthread_mutex_init(&lock->mut,
pthread_mutexattr_default);

returned a non-zero (failure) status. "Invalid argument" is what the
platform perror() produced. A coredump after an error here isn't
surprising.

This is likely the first call made to any pthreads function, and is so
vanilla that I'd guess pthreads itself doesn't work on your platform (does
it from C?), or it's some non-std pthreads variant that thread_pthread.h
doesn't know about.

not-that-insight-implies-a-cure-ly y'rs - tim
HPUX and threads? [ In reply to ]
jon@rdt.monash.edu.au (Jonathan Giddy) writes:
> Markus Stenberg <mstenber@cc.Helsinki.FI> writes:
> >Is HPUX-11 thread support tested/implemented/whatnot?
> Implemented - yes, tested - not in your environment (until now).

Very well, let's see about it now ;-)

> >This at least does not look promising..
> ># /opt/python/bin/python
> >pthread_mutex_init: Invalid argument
> >Memory fault(coredump)
>
> OK, this is probably due to an incorrect guess about which version of
> pthreads is being used.
>
> If you look at the beginning of the source file Python/thread_pthread.h
> you'll see a series of preprocessor tests, defining PY_PTHREAD_D4 and
> friends.
>
> It seems HPUX selects either Draft 4 or the final standard, based on whether
> _DECTHREADS_ is defined. Try placing the following after the #endif
>
> #if defined(PY_PTHREAD_D4)
> #error PY_PTHREAD_D4
> #elif defined(PY_PTHREAD_D6)
> #error PY_PTHREAD_D6
> #elif defined(PY_PTHREAD_D7)
> #error PY_PTHREAD_D7
> #else
> #error PY_PTHREAD_STD
> #endif

This resulted in PY_PTHREAD_STD as follows.

> make clean and recompile. This will (hopefully) give you an error like:
> In file included from thread.c:146:
> thread_pthread.h:88: #error PY_PTHREAD_STD
>
> which tells you which version was assumed. Then, try undefining the
> assumed value, and replace it with the likely correct value.
>
> So, if you get PY_PTHREAD_STD, then replace the code above with:
> #undef PY_PTHREAD_STD
> #define PY_PTHREAD_D4

No luck with _this_, I'm afraid.. nor with D6 or D7. D6 and STD compiled,
but both resulted in coredump_ok binaries.

> then make clean; make
>
> That will hopefully get you running. A more permanent solution requires
> someone who knows the history of pthreads on HPUX.
>
> Jon.

-Markus

--
"I don't truly see how _playing_ gods and demons is odder than
_believing_ in them." [response to one of those anti-RPG comments]
HPUX and threads? [ In reply to ]
"Tim Peters" <tim_one@email.msn.com> writes:
> [Markus Stenberg]
> > Is HPUX-11 thread support tested/implemented/whatnot?
>
> You may want to ask on the Thread-SIG if you don't get an answer here.
>
> > This at least does not look promising..
> >
> > # /opt/python/bin/python
> > pthread_mutex_init: Invalid argument
> > Memory fault(coredump)
> >
> > (also tests failed with the same message, obviously)
> Are you running pthreads? Python is sure trying to <wink>.

I am totally clueless as to C-based threads in general and pthreads in
particular. There are manual pages for pthread* things, and the library,
thus, I suppose I am.

> The msg is coming from line 263 of Python/thread_pthread.h. It means the
> platform's
>
> status = pthread_mutex_init(&lock->mut,
> pthread_mutexattr_default);

Manual page says this.. wonder what lock->mut is, hopefully this type ;)

int pthread_mutex_init(
pthread_mutex_t *mutex,
const pthread_mutexattr_t *attr
);

> returned a non-zero (failure) status. "Invalid argument" is what the
> platform perror() produced. A coredump after an error here isn't
> surprising.
>
> This is likely the first call made to any pthreads function, and is so
> vanilla that I'd guess pthreads itself doesn't work on your platform (does
> it from C?), or it's some non-std pthreads variant that thread_pthread.h
> doesn't know about.

Seems like non-std pthreads variant that thread_pthread.h doesn't know
about (see my other post).

> not-that-insight-implies-a-cure-ly y'rs - tim

-Markus

--
We are Pentium of Borg. Division is futile. You will be approximated.
HPUX and threads? [ In reply to ]
[Markus Stenberg, watching pthreads die under HPUX-11]
> # /opt/python/bin/python
> pthread_mutex_init: Invalid argument
> Memory fault(coredump)

[Tim]
>> The msg is coming from line 263 of Python/thread_pthread.h. It
>> means the platform's
>>
>> status = pthread_mutex_init(&lock->mut,
>> pthread_mutexattr_default);
>>
>> returned a non-zero (failure) status. "Invalid argument" is what the
>> platform perror() produced. A coredump after an error here isn't
>> surprising.

[Markus]
> Manual page says this.. wonder what lock->mut is, hopefully this type ;)
>
> int pthread_mutex_init(
> pthread_mutex_t *mutex,
> const pthread_mutexattr_t *attr
> );

Yes, lock->mut has the right type. So it's griping about
pthread_mutexattr_default. Near line 80 you'll find:

/* set default attribute object for different versions */

#if defined(PY_PTHREAD_D4) || defined(PY_PTHREAD_D7)
# define pthread_attr_default pthread_attr_default
# define pthread_mutexattr_default pthread_mutexattr_default
# define pthread_condattr_default pthread_condattr_default
#elif defined(PY_PTHREAD_STD) || defined(PY_PTHREAD_D6)
# define pthread_attr_default ((pthread_attr_t *)NULL)
# define pthread_mutexattr_default ((pthread_mutexattr_t *)NULL)
# define pthread_condattr_default ((pthread_condattr_t *)NULL)
#endif

I can't tell you what to do next, but that's the place you need to do it.
It would help most if you could find someone who has used pthreads under
your God-forsaken OS <wink>.

windows-may-crash-3-times-a-minute-but-by-god-when-it's-up-it-
sometimes-works-ly y'rs - tim