diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-05-26 16:32:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-26 16:32:19 +0200 |
commit | d6b4e7a1955a9b584a87c7e6227a2c0e0a64cb4c (patch) | |
tree | 94aced14835deb78987c83b0586b25086f7567aa /libpod | |
parent | e81457dc8e6632f4e9c7a4d240c9a73e8d509bb3 (diff) | |
parent | d1c9e034ff2d1570f87bcba6d8fa555752e6d6e0 (diff) | |
download | podman-d6b4e7a1955a9b584a87c7e6227a2c0e0a64cb4c.tar.gz podman-d6b4e7a1955a9b584a87c7e6227a2c0e0a64cb4c.tar.bz2 podman-d6b4e7a1955a9b584a87c7e6227a2c0e0a64cb4c.zip |
Merge pull request #10466 from vrothberg/fix-10459
libimage-events channel: fix data race
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/runtime.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go index 713026a9e..e551e6fe8 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -217,8 +217,6 @@ func newRuntimeFromConfig(ctx context.Context, conf *config.Config, options ...R return nil, err } - runtime.libimageEventsShutdown = make(chan bool) - return runtime, nil } @@ -701,6 +699,8 @@ var libimageEventsMap = map[libimage.EventType]events.Status{ // events on the libimage.Runtime. The gourtine will be cleaned up implicitly // when the main() exists. func (r *Runtime) libimageEvents() { + r.libimageEventsShutdown = make(chan bool) + toLibpodEventStatus := func(e *libimage.Event) events.Status { status, found := libimageEventsMap[e.Type] if !found { @@ -780,7 +780,9 @@ func (r *Runtime) Shutdown(force bool) error { // attempt to shut it down if r.store != nil { // Wait for the events to be written. - r.libimageEventsShutdown <- true + if r.libimageEventsShutdown != nil { + r.libimageEventsShutdown <- true + } // Note that the libimage runtime shuts down the store. if err := r.libimageRuntime.Shutdown(force); err != nil { |