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>
This commit is contained in:
Anusha Ragunathan 2016-11-28 12:44:40 -08:00
parent 783d4ac6d4
commit 890a98ceed

View file

@ -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)