I'm able to produce this issue using multijob plugin and trying to do a safeShutdown api and get a deadlock on waiting for jenkins to shutdown.
Jobs required to reproduce, The child Jobs are serial not multiphase.
- Parent Job
- Child 1 Job
- Child 2 Job
What happens is parent job is running during the time the URL API call is made. Jenkins behavior is let all jobs finish and queue any future jobs. This allows the childjob 1 or 2 to get in the queue. The parent job is holding on to the child job calls waiting for them to complete but that won't happen since they are in queue.