Ver código fonte

Fixing a race condition that caused a Panic when deleting overlay network then quickly leaving swarm.
This issue was uncovered in TestOverlayAttachableReleaseResourcesOnFailure.

Signed-off-by: Pradip Dhara <pradipd@microsoft.com>

Pradip Dhara 7 anos atrás
pai
commit
495252723d
1 arquivos alterados com 7 adições e 0 exclusões
  1. 7 0
      libnetwork/sandbox.go

+ 7 - 0
libnetwork/sandbox.go

@@ -916,6 +916,13 @@ func (sb *sandbox) clearNetworkResources(origEp *endpoint) error {
 			break
 		}
 	}
+
+	if index == -1 {
+		logrus.Errorf("Endpoint %s has already been deleted", ep.Name())
+		sb.Unlock()
+		return nil
+	}
+
 	heap.Remove(&sb.endpoints, index)
 	for _, e := range sb.endpoints {
 		if len(e.Gateway()) > 0 {