Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http/pprof: pprof over HTTPS #16073

Closed
Allendar opened this issue Jun 15, 2016 · 3 comments
Closed

net/http/pprof: pprof over HTTPS #16073

Allendar opened this issue Jun 15, 2016 · 3 comments

Comments

@Allendar
Copy link

Allendar commented Jun 15, 2016

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?

1.6

  1. What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/erwin/Go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.6.2/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.6.2/libexec/pkg/tool/darwin_amd64"
GO15VENDOREXPERIMENT="1"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"
  1. What did you do?
$ go tool pprof https://127.0.0.1:8900/debug/pprof/profile
  1. What did you expect to see?

PPROF console/result

  1. What did you see instead?
Fetching profile from https://127.0.0.1:8900/debug/pprof/profile
Please wait... (30s)
http fetch https://127.0.0.1:8900/debug/pprof/profile: Get https://127.0.0.1:8900/debug/pprof/profile: x509: cannot validate certificate for 127.0.0.1 because it doesn't contain any IP SANs

How can I actually hand my certificate over to the pprof tool?

@mdempsky
Copy link
Member

Your certificate is already being transported to the pprof tool over the HTTPS connection. The problem is it's not valid for the IP address 127.0.0.1.

@ianlancetaylor ianlancetaylor changed the title pprof over HTTPS net/http/pprof: pprof over HTTPS Jun 15, 2016
@Allendar
Copy link
Author

Allendar commented Jun 15, 2016

Ah yes that seemed to fixed it. Oddly enough browsers and test-tools accept both 127.0.0.1 and localhost locally for testing on that certificate tho.

Now I'm not getting any output tho. I'm using Gin and have _ "net/http/pprof" also imported but not seeing anything:

$ go tool pprof https://localhost:8900/debug/pprof/profile
Fetching profile from https://localhost:8900/debug/pprof/profile
Please wait... (30s)
Saved profile in /Users/erwin/pprof/pprof.localhost:8900.samples.cpu.002.pb.gz
Entering interactive mode (type "help" for commands)
(pprof) list
profile is empty
(pprof) top5
profile is empty
(pprof) top
profile is empty

Am I missing something?

My overview page show this after calling some heavier URLs (milliseconds):

/debug/pprof/

profiles:
0   block
9   goroutine
21  heap
12  threadcreate

full goroutine stack dump

I also tried running build from the CLI and it also didn't create any pprof data while running HTTP server (Gin). All my normal (non-web) Go apps profile without issues.

UPDATE

Now it shows something, but still weird results:

$ go tool pprof https://localhost:8900/debug/pprof/profile
Fetching profile from https://localhost:8900/debug/pprof/profile
Please wait... (30s)
Saved profile in /Users/erwin/pprof/pprof.localhost:8900.samples.cpu.003.pb.gz
Entering interactive mode (type "help" for commands)
(pprof) top5
9.86s of 9.86s total (  100%)
      flat  flat%   sum%        cum   cum%
     9.86s   100%   100%      9.86s   100%  
(pprof) top
9.86s of 9.86s total (  100%)
      flat  flat%   sum%        cum   cum%
     9.86s   100%   100%      9.86s   100%  
(pprof) list
Total: 9.86s
(pprof)

@mdempsky
Copy link
Member

I'm guessing your service was idle during those 30 seconds, so there was nothing for pprof to measure.

It seems like there's no bug here, so I'm going to optimistically close. Happy to reopen if mistaken though.

If you have more questions about using Go (as opposed to suspected problems within Go itself), please see: https://github.com/golang/go/wiki/Questions

Cheers

@golang golang locked and limited conversation to collaborators Jun 15, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants