Skip to content

Commit

Permalink
fix pprof hanging the app
Browse files Browse the repository at this point in the history
  • Loading branch information
arriven committed Mar 28, 2022
1 parent 4ffefe8 commit 90d8204
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ func setUpPprof(pprof string, debug bool) {
mux.Handle("/debug/pprof/symbol", http.HandlerFunc(pprofhttp.Symbol))
mux.Handle("/debug/pprof/trace", http.HandlerFunc(pprofhttp.Trace))

go log.Println(http.ListenAndServe(pprof, mux))
// this has to be wrapped into a lambda bc otherwise it blocks when evaluating argument for log.Println
go func() { log.Println(http.ListenAndServe(pprof, mux)) }()
}

func cancelOnSignal(cancel context.CancelFunc) {
Expand Down

0 comments on commit 90d8204

Please sign in to comment.