Skip to content

Restore availability of pprof in the debug server

Tomasz Maczukin requested to merge restore-pprof-debug-endpoint into master

What does this MR do?

Restore pprof debugging endpoint that was removed by mistake when workingon !934 (merged)

Why was this MR needed?

With !934 (merged) we've changed how the debug server is started. It can be seen at !934 (diffs):

+               mux := http.NewServeMux()
+
                go func() {
-                       log.Fatalln(http.Serve(listener, nil))
+                       log.Fatalln(http.Serve(listener, mux))
                }()

Instead of relaying on the http.DefaultServeMux (which is used when http.Serve(listener, nil) is called), we're creating our own ServeMux which next is used for handling requests.

Unfortunately this breaks automatic registration of pprof handlers, which in net/http/pprof's init() are using http.Handle(), which registers the handlers in http.DefaultServeMux.

Are there points in the code the reviewer needs to double check?

Does this MR meet the acceptance criteria?

  • Documentation created/updated
  • Added tests for this feature/bug
  • In case of conflicts with master - branch was rebased

What are the relevant issue numbers?

Merge request reports