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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
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 23:00:32
Message-ID: 11405.1572390032@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thomas Munro <thomas(dot)munro(at)gmail(dot)com> writes:
> ... 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?

I poked around in that repo, and found the non-stub version of
pthread_self:

https://github.com/NetBSD/src/blob/trunk/lib/libpthread/pthread.c#L863

Relevant to this discussion is that it actually redirects to the
stub version if __uselibcstub is still set, and that variable
appears to be cleared by pthread__init,

https://github.com/NetBSD/src/blob/trunk/lib/libpthread/pthread.c#L187

whose header comment is pretty telling:

/*
* This needs to be started by the library loading code, before main()
* gets to run, for various things that use the state of the initial thread
* to work properly (thread-specific data is an application-visible example;
* spinlock counts for mutexes is an internal example).
*/

I've not found the mechanism by which pthread__init gets called, but
this sure smells like they think it only has to happen before main().

Interestingly, some of the other files in that directory have recent
CVS log entries specifically mentioning bug fixes for cases where
libpthread is dlopen'd. So it's not like they don't want to support
the case. I wonder if they just need to fix pthread_self to forcibly
init the library if __uselibcstub is still set.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2019-10-29 23:33:41 pg_waldump erroneously outputs newline for FPWs, and another minor bug
Previous Message Tom Lane 2019-10-29 22:05:25 Re: PL/Python fails on new NetBSD/PPC 8.0 install