Bug#1099624: libc6 2.41 pthread cause pari to FTBFS
On Mon, Mar 10, 2025 at 03:18:07PM +0100, Bill Allombert wrote:
> In that spirit, please find a third one, which fail with both libc,
> but in a different way.
>
> About 10% of the time, it hangs in 'exit' after all threads have terminated.
(This is an aside to this bug report, but is better to be thorough.)
For what is worth, I think I found the problem with this one test:
> static void
> mt_err_recover(void)
> {
> if (mt_thread_no>=0)
> {
> struct mt_pstate *mt = pari_mt;
> struct mt_queue *mq = mt->mq+mt_thread_no;
> LOCK(mq->pmut)
> {
> mq->output = -1;
> pthread_cond_signal(mq->pcond);
> } UNLOCK(mq->pmut);
> pthread_exit((void*)-1);
> }
> }
This function is called in PTHREAD_CANCEL_ASYNCHRONOUS mode,
I am not sure calling pthread_exit with PTHREAD_CANCEL_ASYNCHRONOUS
is valid.
Adding
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED,NULL)
before LOCK seems to fix the problem.
So this one is probably a bug in PARI/GP.
Cheers,
Bill.
Reply to: