From e1094916aceff77d16aea60891e613715c72818e Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 23 Nov 2015 22:09:45 +0100 Subject: master: fix deadlock during corpus minimization Manager can concurrently send RPCs to master, which will deadlock. --- master/html.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'master/html.go') diff --git a/master/html.go b/master/html.go index bb7ac1bd7..40159d156 100644 --- a/master/html.go +++ b/master/html.go @@ -30,9 +30,6 @@ func (m *Master) httpInfo(w http.ResponseWriter, r *http.Request) { } func (m *Master) httpMinimize(w http.ResponseWriter, r *http.Request) { - m.mu.Lock() - defer m.mu.Unlock() - corpus := make(map[string]bool) for _, mgr := range m.managers { resp, err := http.Get("http://" + mgr.http + "/current_corpus") @@ -56,6 +53,10 @@ func (m *Master) httpMinimize(w http.ResponseWriter, r *http.Request) { corpus[hash] = true } } + + m.mu.Lock() + defer m.mu.Unlock() + orig := len(m.corpus.m) m.corpus.minimize(corpus) fmt.Printf("minimized: %v -> %v -> %v\n", orig, len(corpus), len(m.corpus.m)) -- cgit mrf-deployment