Skip to content

Commit c819c7a

Browse files
Farya L. Maertenlambinoo
Farya L. Maerten
authored andcommitted
create runtime's worker queue before queuing any job
It seems that if some background tasks are queued in libpod's Runtime before the worker's channel is set up (eg. in the refresh phase), they are not executed later on, but the workerGroup's counter is still ticked up. This leads podman to hang when the imageEngine is shutdown, since it waits for the workerGroup to be done. fixes #22984 Signed-off-by: Farya Maerten <[email protected]>
1 parent abf0350 commit c819c7a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

libpod/runtime.go

+5
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,11 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (retErr error) {
613613
// refresh runs.
614614
runtime.valid = true
615615

616+
// Setup the worker channel early to start accepting jobs from refresh,
617+
// but do not start to execute the jobs right away. The runtime is not
618+
// ready at this point.
619+
runtime.setupWorkerQueue()
620+
616621
// If we need to refresh the state, do it now - things are guaranteed to
617622
// be set up by now.
618623
if doRefresh {

libpod/runtime_worker.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
package libpod
44

5-
func (r *Runtime) startWorker() {
5+
func (r *Runtime) setupWorkerQueue() {
66
r.workerChannel = make(chan func(), 10)
7+
}
8+
9+
func (r *Runtime) startWorker() {
710
go func() {
811
for w := range r.workerChannel {
912
w()

0 commit comments

Comments
 (0)