Przeglądaj źródła

Fix issue with plugin exit.

A plugin has an `ExitChan` channel which is used to signal the exit of
the plugin process. In a recent change, the initialization was
incorrectly moved to the daemon Shutdown path.

Fix this by initializing the channel during plugin enable.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
(cherry picked from commit 890a98ceed982454515f5b089d9772fc1e4eb6e0)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
Anusha Ragunathan 8 lat temu
rodzic
commit
8c56588d04
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      plugin/manager_linux.go

+ 1 - 1
plugin/manager_linux.go

@@ -26,6 +26,7 @@ func (pm *Manager) enable(p *v2.Plugin, force bool) error {
 	}
 	p.Lock()
 	p.Restart = true
+	p.ExitChan = make(chan bool)
 	p.Unlock()
 	if err := pm.containerdClient.Create(p.GetID(), "", "", specs.Spec(*spec), attachToLog(p.GetID())); err != nil {
 		return err
@@ -92,7 +93,6 @@ func (pm *Manager) Shutdown() {
 		}
 		if pm.containerdClient != nil && p.IsEnabled() {
 			p.Lock()
-			p.ExitChan = make(chan bool)
 			p.Restart = false
 			p.Unlock()
 			shutdownPlugin(p, pm.containerdClient)