From 03c1f49850f9eac12cd657d6e917b41ec6d00531 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Mon, 11 May 2015 19:38:06 +0100 Subject: [PATCH] make profiling work again The weave SIGINT signal handler was racing the profiler SIGINT signal handler. So now we a) make the former return instead of exit, and b) disable the latter, as a result of which the deferred profile.Stop in weaver/main gets called. --- common/signals.go | 2 +- weaver/main.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/common/signals.go b/common/signals.go index fdc49119..f92f3f60 100644 --- a/common/signals.go +++ b/common/signals.go @@ -24,7 +24,7 @@ func SignalHandlerLoop(ss ...SignalReceiver) { for _, subsystem := range ss { subsystem.Stop() } - os.Exit(0) + return case syscall.SIGQUIT: stacklen := runtime.Stack(buf, true) Info.Printf("=== received SIGQUIT ===\n*** goroutine dump...\n%s\n*** end\n", buf[:stacklen]) diff --git a/weaver/main.go b/weaver/main.go index ecdbd89d..02b79538 100644 --- a/weaver/main.go +++ b/weaver/main.go @@ -112,6 +112,7 @@ func main() { if prof != "" { p := *profile.CPUProfile p.ProfilePath = prof + p.NoShutdownHook = true defer profile.Start(&p).Stop() }