From c254f3f59c2ee34f27ff09e9328196058ff38d23 Mon Sep 17 00:00:00 2001 From: Jana Radhakrishnan Date: Tue, 18 Oct 2016 10:20:05 -0700 Subject: [PATCH] Fix map access race in populatedEndpoints Signed-off-by: Jana Radhakrishnan --- sandbox.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sandbox.go b/sandbox.go index f5d86ef20e..7d1eef5b73 100644 --- a/sandbox.go +++ b/sandbox.go @@ -848,8 +848,9 @@ func (sb *sandbox) clearNetworkResources(origEp *endpoint) error { releaseOSSboxResources(osSbox, ep) } - delete(sb.populatedEndpoints, ep.ID()) sb.Lock() + delete(sb.populatedEndpoints, ep.ID()) + if len(sb.endpoints) == 0 { // sb.endpoints should never be empty and this is unexpected error condition // We log an error message to note this down for debugging purposes.