mirror of
https://github.com/containers/podman.git
synced 2025-05-17 23:26:08 +08:00
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>
This commit is contained in:

committed by
Farya Maerten

parent
abf0350529
commit
c819c7a973
@ -613,6 +613,11 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (retErr error) {
|
||||
// refresh runs.
|
||||
runtime.valid = true
|
||||
|
||||
// Setup the worker channel early to start accepting jobs from refresh,
|
||||
// but do not start to execute the jobs right away. The runtime is not
|
||||
// ready at this point.
|
||||
runtime.setupWorkerQueue()
|
||||
|
||||
// If we need to refresh the state, do it now - things are guaranteed to
|
||||
// be set up by now.
|
||||
if doRefresh {
|
||||
|
@ -2,8 +2,11 @@
|
||||
|
||||
package libpod
|
||||
|
||||
func (r *Runtime) startWorker() {
|
||||
func (r *Runtime) setupWorkerQueue() {
|
||||
r.workerChannel = make(chan func(), 10)
|
||||
}
|
||||
|
||||
func (r *Runtime) startWorker() {
|
||||
go func() {
|
||||
for w := range r.workerChannel {
|
||||
w()
|
||||
|
Reference in New Issue
Block a user