Browse code

Add workaround for possible SetClusterProvider deadlock

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>

Tonis Tiigi authored on 2017/01/11 08:11:49
Showing 1 changed files
... ...
@@ -449,7 +449,9 @@ func (daemon *Daemon) registerLink(parent, child *container.Container, alias str
449 449
 // SetClusterProvider sets a component for querying the current cluster state.
450 450
 func (daemon *Daemon) SetClusterProvider(clusterProvider cluster.Provider) {
451 451
 	daemon.clusterProvider = clusterProvider
452
-	daemon.netController.SetClusterProvider(clusterProvider)
452
+	// call this in a goroutine to allow netcontroller handle this event async
453
+	// and not block if it is in the middle of talking with cluster
454
+	go daemon.netController.SetClusterProvider(clusterProvider)
453 455
 }
454 456
 
455 457
 // IsSwarmCompatible verifies if the current daemon