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

cmd/pprof: runtime panic index out of range if given empty cpu.prof #9207

Closed
gopherbot opened this issue Dec 4, 2014 · 10 comments
Closed

cmd/pprof: runtime panic index out of range if given empty cpu.prof #9207

gopherbot opened this issue Dec 4, 2014 · 10 comments
Milestone

Comments

@gopherbot
Copy link

@gopherbot gopherbot commented Dec 4, 2014

by jgardner@izeni.com:

go version go1.4rc2 linux/amd64

Here's the output: 

go tool pprof -svg ./chatads-keyword-extraction /tmp/profile223797702/cpu.pprof
panic: runtime error: index out of range
 
goroutine 1 [running]:
cmd/pprof/internal/driver.sampleFormat(0xc20808a000, 0xc208092000, 0xc2080c8240, 0x0,
0x0, 0x0, 0x0)
        /usr/src/go/src/cmd/pprof/internal/driver/driver.go:975 +0x21c
cmd/pprof/internal/driver.generate(0xc20808a000, 0xc20808a000, 0x7f0b01303ff0,
0xc20802afc0, 0x7f0b01303fa8, 0xc20804e060, 0xc208092000, 0x0, 0x0)
        /usr/src/go/src/cmd/pprof/internal/driver/driver.go:1012 +0x11f
cmd/pprof/internal/driver.PProf(0x7f0b01304030, 0xae7048, 0x96fb50, 0x970118,
0x7f0b01303ff0, 0xc20802afc0, 0x7f0b01303fa8, 0xc20804e060, 0x0, 0x0, ...)
        /usr/src/go/src/cmd/pprof/internal/driver/driver.go:115 +0xc8d
main.main()
        /usr/src/go/src/cmd/pprof/pprof.go:28 +0x129

Attachments:

  1. chatads-keyword-extraction (8560645 bytes)
  2. cpu.pprof (0 bytes)
@davecheney
Copy link
Contributor

@davecheney davecheney commented Dec 4, 2014

Comment 1:

The profile file is zero bytes. Is this intentional? Just checking to see if this wasn't
a mistake when uploading the file.
@minux
Copy link
Member

@minux minux commented Dec 4, 2014

Comment 2:

i think that explains the crash.
@gopherbot
Copy link
Author

@gopherbot gopherbot commented Dec 4, 2014

Comment 3 by jgardner@izeni.com:

It wasn't intentional for the profile file to be empty but it was and that explains the
crash I think too.
@minux
Copy link
Member

@minux minux commented Dec 4, 2014

Comment 4:

Not important enough for 1.4.

Labels changed: added release-none, repo-main.

Status changed to Accepted.

@se77en
Copy link

@se77en se77en commented Jan 7, 2015

encounter same issue :(

@minux minux added this to the Go1.5 milestone Jan 7, 2015
@osocurioso
Copy link
Contributor

@osocurioso osocurioso commented Jan 8, 2015

I'd like to try my hand at this. Seems like a perfect issue for a first-timer.

@minux
Copy link
Member

@minux minux commented Jan 8, 2015

Sure, please go ahead.

The contribution guideline is here:
golang.org/doc/contribute.html

Please note that it's not as simple as adding a check for
len() > 0, you will need to find the right place to check
for empty profiles (or more generally, malformed profiles)

@osocurioso
Copy link
Contributor

@osocurioso osocurioso commented Jan 12, 2015

I actually ended up with a simple check for len() == 0, only carefully placed. See golang.org/cl/2571. There was already a fair bit of checking for malformed data there but this particular case was missed.

@osocurioso
Copy link
Contributor

@osocurioso osocurioso commented Jan 14, 2015

Clickable link: http://golang.org/cl/2571

@rsc rsc removed accepted labels Apr 14, 2015
@gopherbot
Copy link
Author

@gopherbot gopherbot commented Apr 25, 2015

CL https://golang.org/cl/2571 mentions this issue.

@bradfitz bradfitz closed this in 14a4649 Apr 26, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.