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: weblist is unusable on Go1.7 #16154

Closed
dsnet opened this issue Jun 22, 2016 · 4 comments
Closed

cmd/pprof: weblist is unusable on Go1.7 #16154

dsnet opened this issue Jun 22, 2016 · 4 comments
Assignees
Milestone

Comments

@dsnet
Copy link
Member

@dsnet dsnet commented Jun 22, 2016

Using 4764d6f

Using the weblist command in pprof now generates an unreasonably large html file. In Go1.6 this generates a 209KB html file, while HEAD generates a 450MB html file for even a simple benchmark. On larger benchmarks (which are far more common), this crashes the system by using up all system memory.

Current behavior:

$ go.dev test -c foo_test.go
$ ./foo.test -test.bench . -test.cpuprofile /tmp/cpu.out
$ go.dev tool pprof ./foo.test /tmp/cpu.out
(pprof) weblist # Stalls for several seconds... the output html file is 450MB

Wanted behavior:

$ go1.6 test -c foo_test.go
$ ./foo.test -test.bench . -test.cpuprofile /tmp/cpu.out
$ go1.6 tool pprof ./foo.test /tmp/cpu.out
(pprof) weblist # Immediately launches browser with html file that is 209KB

Contents of foo_test.go (could be anything):

package foo

import (
    "bufio"
    "io"
    "strings"
    "testing"
)

func BenchmarkFoo(b *testing.B) {
    s := strings.Repeat("Hello, world!", 100000)

    b.SetBytes(int64(len(s)))
    for i := 0; i < b.N; i++ {
        var r io.ByteReader
        r = bufio.NewReader(strings.NewReader(s))
        for {
            _, err := r.ReadByte()
            if err != nil {
                if err == io.EOF {
                    break
                }
                b.Fatal(err)
            }
        }
    }
}
@dsnet dsnet added this to the Go1.7 milestone Jun 22, 2016
@dsnet
Copy link
Member Author

@dsnet dsnet commented Jun 22, 2016

@dsnet dsnet self-assigned this Jun 24, 2016
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jun 24, 2016

@dsnet Just noticed that you self-assigned this--I've been looking at this and I just figured it out.

@gopherbot
Copy link

@gopherbot gopherbot commented Jun 24, 2016

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

@gopherbot
Copy link

@gopherbot gopherbot commented Jun 24, 2016

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

@gopherbot gopherbot closed this in 83e839f Jun 24, 2016
@golang golang locked and limited conversation to collaborators Jun 25, 2017
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
3 participants
You can’t perform that action at this time.