• Tomasz Maczukin's avatar
    Restore availability of pprof in the debug server · 0cb2512f
    Tomasz Maczukin authored
    With CI Web Terminal initial implementation
    (gitlab-org/gitlab-runner!934)
    we've changed the way how the debug server is started.
    
    It can be seen at gitlab-org/gitlab-runner!934 (diffs)
    
    ```diff
    +		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`.
    
    This commit adds an explicit registration of pprof handlers to the
    `mux` ServeMux created by us. This will restore the functionality
    that we had present before version 11.3.0.
    0cb2512f
Name
Last commit
Last update
..
helpers Loading commit data...
builds_helper.go Loading commit data...
builds_helper_test.go Loading commit data...
config.go Loading commit data...
config_test.go Loading commit data...
config_unix.go Loading commit data...
config_windows.go Loading commit data...
exec.go Loading commit data...
health_helper.go Loading commit data...
list.go Loading commit data...
multi.go Loading commit data...
multi_test.go Loading commit data...
register.go Loading commit data...
register_test.go Loading commit data...
service.go Loading commit data...
service_test.go Loading commit data...
single.go Loading commit data...
single_test.go Loading commit data...
unregister.go Loading commit data...
user_mode_warning.go Loading commit data...
verify.go Loading commit data...