Explorar el Código

Merge pull request #13643 from LK4D4/fix_registry_race

Fix race condition in registry/session
Jessie Frazelle hace 10 años
padre
commit
488c355d94
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      registry/session.go

+ 5 - 1
registry/session.go

@@ -98,7 +98,11 @@ func (tr *authTransport) RoundTrip(orig *http.Request) (*http.Response, error) {
 	}
 	resp.Body = &transport.OnEOFReader{
 		Rc: resp.Body,
-		Fn: func() { delete(tr.modReq, orig) },
+		Fn: func() {
+			tr.mu.Lock()
+			delete(tr.modReq, orig)
+			tr.mu.Unlock()
+		},
 	}
 	return resp, nil
 }