From: Dmitriy Vyukov Date: Tue, 12 Aug 2014 21:02:01 +0000 (+0400) Subject: runtime/pprof: fix data race X-Git-Tag: go1.4beta1~846 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=fe7b29f5fd5be75484ce7ea89c2b63d96f9baa14;p=gostls13.git runtime/pprof: fix data race It's unclear why we do this broken double-checked locking. The mutex is not held for the whole duration of CPU profiling. Fixes #8365. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/116290043 --- diff --git a/src/pkg/runtime/pprof/pprof.go b/src/pkg/runtime/pprof/pprof.go index 26aa0b8be5..236de54f38 100644 --- a/src/pkg/runtime/pprof/pprof.go +++ b/src/pkg/runtime/pprof/pprof.go @@ -574,12 +574,6 @@ func StartCPUProfile(w io.Writer) error { // each client to specify the frequency, we hard code it. const hz = 100 - // Avoid queueing behind StopCPUProfile. - // Could use TryLock instead if we had it. - if cpu.profiling { - return fmt.Errorf("cpu profiling already in use") - } - cpu.Lock() defer cpu.Unlock() if cpu.done == nil {