Bläddra i källkod

Merge pull request #1512 from mrjana/bugs

Fix map access race in populatedEndpoints
Santhosh Manohar 8 år sedan
förälder
incheckning
ed88549edb
1 ändrade filer med 2 tillägg och 1 borttagningar
  1. 2 1
      libnetwork/sandbox.go

+ 2 - 1
libnetwork/sandbox.go

@@ -848,8 +848,9 @@ func (sb *sandbox) clearNetworkResources(origEp *endpoint) error {
 		releaseOSSboxResources(osSbox, ep)
 		releaseOSSboxResources(osSbox, ep)
 	}
 	}
 
 
-	delete(sb.populatedEndpoints, ep.ID())
 	sb.Lock()
 	sb.Lock()
+	delete(sb.populatedEndpoints, ep.ID())
+
 	if len(sb.endpoints) == 0 {
 	if len(sb.endpoints) == 0 {
 		// sb.endpoints should never be empty and this is unexpected error condition
 		// sb.endpoints should never be empty and this is unexpected error condition
 		// We log an error message to note this down for debugging purposes.
 		// We log an error message to note this down for debugging purposes.