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>
| ... | ... |
@@ -26,6 +26,7 @@ func (pm *Manager) enable(p *v2.Plugin, force bool) error {
|
| 26 | 26 |
} |
| 27 | 27 |
p.Lock() |
| 28 | 28 |
p.Restart = true |
| 29 |
+ p.ExitChan = make(chan bool) |
|
| 29 | 30 |
p.Unlock() |
| 30 | 31 |
if err := pm.containerdClient.Create(p.GetID(), "", "", specs.Spec(*spec), attachToLog(p.GetID())); err != nil {
|
| 31 | 32 |
return err |
| ... | ... |
@@ -92,7 +93,6 @@ func (pm *Manager) Shutdown() {
|
| 92 | 92 |
} |
| 93 | 93 |
if pm.containerdClient != nil && p.IsEnabled() {
|
| 94 | 94 |
p.Lock() |
| 95 |
- p.ExitChan = make(chan bool) |
|
| 96 | 95 |
p.Restart = false |
| 97 | 96 |
p.Unlock() |
| 98 | 97 |
shutdownPlugin(p, pm.containerdClient) |