Subject: bug#63190: [Shepherd] Nested calls lead to a hang

From: Brian Cully <[email-masked]>
Date: Fri, 12 May 2023 19:01:08 -0400

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

> (Whether that leads to a deadlock depends; at first sight, I’d 
> say
> there’s no reason for this to deadlock in general, but you can 
> of course
> end up with a logic bug like A starts B, which spawns a client 
> to start
> A, which doesn’t start because it’s waiting for B.)

It's been a while since I looked at this, but my rough 
recollection is the deadlock occurs because shepherd can only 
process one request over its socket at a time. If that request 
happens to *also* try to talk over the same socket, it'll hang 
indefinitely waiting for its turn to come off the accept queue.

I'm not sure there's much to be done in the 0.9 version of 
shepherd about it. I'm hoping that 0.10 and up will be able to 
cope with situations like this without completely deadlocking the 
shepherd itself. It's obviously pretty bad if pid 1 hangs for any 
reason at all, even user error.

-bjc