mirror of
https://github.com/docker/cli.git
synced 2026-09-25 07:50:37 -05:00
Merge pull request #30408 from cpuguy83/fix_plugin_wait
Fix deadlock on v1 plugin with activate error Upstream-commit: 113e9f07f49e9089df41585aeb355697b4c96120 Component: engine
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package plugins
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"sync"
|
||||
@@ -20,6 +21,12 @@ func TestPluginAddHandler(t *testing.T) {
|
||||
testActive(t, p)
|
||||
}
|
||||
|
||||
func TestPluginWaitBadPlugin(t *testing.T) {
|
||||
p := &Plugin{activateWait: sync.NewCond(&sync.Mutex{})}
|
||||
p.activateErr = errors.New("some junk happened")
|
||||
testActive(t, p)
|
||||
}
|
||||
|
||||
func testActive(t *testing.T, p *Plugin) {
|
||||
done := make(chan struct{})
|
||||
go func() {
|
||||
|
||||
@@ -169,7 +169,7 @@ func (p *Plugin) activateWithLock() error {
|
||||
|
||||
func (p *Plugin) waitActive() error {
|
||||
p.activateWait.L.Lock()
|
||||
for !p.activated() {
|
||||
for !p.activated() && p.activateErr == nil {
|
||||
p.activateWait.Wait()
|
||||
}
|
||||
p.activateWait.L.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user