Re: PL/Python fails on new NetBSD/PPC 8.0 install

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Benjamin Scherrey <scherrey(at)proteus-tech(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: PL/Python fails on new NetBSD/PPC 8.0 install
Date: 2019-10-29 21:38:24
Message-ID: CA+hUKGKAgZsjDdc0afuf2pB8+aOc2Tm4RHbi9R02OdEciQQLGQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Oct 30, 2019 at 9:25 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> What I'm inclined to do is go file a bug report saying that this
> behavior contradicts both POSIX and NetBSD's own man page, and
> see what they say about that.

From a quick look at the relevant trees, isn't the problem here that
cpython thinks it can reserve pthread_t value -1 (or rather, that
number cast to unsigned long, which is the type it uses for its own
thread IDs):

https://github.com/python/cpython/blob/master/Include/pythread.h#L21

... and then use that to detect lack of initialisation:

https://github.com/python/cpython/blob/master/Modules/_threadmodule.c#L1149

... and that NetBSD also chose the same arbitrary value for their
threading stub library:

https://github.com/NetBSD/src/blob/trunk/lib/libc/thread-stub/thread-stub.c#L392

... as they are entirely within their rights to do? Assuming the stub
library can do whatever it has to do with that value, like answer
questions like pthread_equal(), as it clearly can. I think libc is
allowed to implement pthread_t as an integer type and reserve -1, but
application code is not allowed to assume that pthread_t is even
castable to an integer type, let alone that it can reserve magic
values.

Further evidence that this is Python's fault is the admission in the
source code itself that it is "inherently hosed":

https://github.com/python/cpython/blob/master/Python/thread_pthread.h#L299

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-10-29 22:05:25 Re: PL/Python fails on new NetBSD/PPC 8.0 install
Previous Message Laurenz Albe 2019-10-29 21:05:34 Re: Getting psql to redisplay command after \e