Files
podman/libpod/runtime_worker.go
Farya L. Maerten c819c7a973 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 containers/podman#22984

Signed-off-by: Farya Maerten <me@ltow.me>
2024-07-09 11:15:29 +02:00

24 lines
349 B
Go

//go:build !remote
package libpod
func (r *Runtime) setupWorkerQueue() {
r.workerChannel = make(chan func(), 10)
}
func (r *Runtime) startWorker() {
go func() {
for w := range r.workerChannel {
w()
r.workerGroup.Done()
}
}()
}
func (r *Runtime) queueWork(f func()) {
r.workerGroup.Add(1)
go func() {
r.workerChannel <- f
}()
}