Subject: Re: bug#55441: [cuirass] hang in "In progress..."; runs out of pgsql connections

From: Maxim Cournoyer <[email-masked]>
Date: Mon, 16 May 2022 08:49:28 -0400

Hi Ludo and Mathieu!

Ludovic Courtès <[email-masked]> writes:

> Hi!
>
> Mathieu Othacehe <[email-masked]> skribis:
>
>> I noticed this error: https://ci.guix.gnu.org/eval/320682/log/raw.
>>
>> The following lines can be caused by having a multi-threaded program:
>> (cuirass scripts evaluate) because of its par-for-each procedure, call
>> "primitive-fork" in open-bidirectional-pipe of (guix inferior).
>>
>> warning: call to primitive-fork while multiple threads are running;
>>          further behavior unspecified.  See "Processes" in the
>>          manual, for more information.
>>
>> Not sure that it could cause the observed hang, Ludo what do you think?
>
> As you write, the warning comes from ‘open-bidirectional-pipe’, added in
> commit bd86bbd300474204878e927f6cd3f0defa1662a5.  I noticed it back then
> but as far as I could see, it was harmless (but definitely suboptimal):
>
>   https://issues.guix.gnu.org/48007#11

Thanks for investigating it!

I'm not yet very knowledgeable about POSIX threads and shortcomings, but
this looks like a dangerous trap to have lying around :-).  Is there an
alternative implementation we could come up with that would avoid the
potential problem (and warnings) entirely?

Otherwise, if we are sure there are no practical problems in a
multi-threaded scenario, I think a comment explaining the reasoning in
the code (of why it's considered safe despite the warnings) and a test
exercising the behavior would be in order to ensure it continues working
as intended in the face of changes.

Thoughts?

Thanks again,

Maxim