Subject: Re: bug#59055: [PATCH] Fix possible deadlock.
From: Ludovic Courtès <[email-masked]>
To: Olivier Dion <[email-masked]>
Cc: [email-masked]
Date: Sun, 20 Nov 2022 18:19:07 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

Olivier Dion <[email-masked]> skribis:

> If we got interrupted while waiting on our condition variable, we unlock
> the kernel mutex momentarily while executing asynchronous operations
> before putting us back into the waiting queue.
>
> However, we have to retry acquiring the mutex before getting back into
> the queue, otherwise it's possible that we wait indefinitely since
> nobody could be the owner for a while.
>
> * libguile/threads.c (lock_mutex): Try acquring the mutex after signal
> interruption.

Looks reasonable to me; applied.

Did you try to come up with a reproducer?  That would be awesome but I
guess it’s hard because you need to trigger EINTR at the right point.

Thanks,
Ludo’.