Skip to content

runtime/pprof: memprofile malformed profile: mismatch: sample has #22036

@sealcomeback

Description

@sealcomeback

Please answer these questions before submitting your issue. Thanks!

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

go1.8.1

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/xiaoju/go"
GORACE=""
GOROOT="/home/xiaoju/push-auto/go1.8.1"
GOTOOLDIR="/home/xiaoju/push-auto/go1.8.1/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build603754697=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

var memprofile string
flag.StringVar(&memprofile, "memprofile", "memprofile", "write mem profile to this file")
        flag.Parse()
        var memfd *os.File = nil
        var err4 error
        if memprofile != "" {
                memfd, err4 = os.Create(memprofile)
                if err4 != nil {
                        fmt.Printf("create memprofileFile error, %v", err4)
                }
                defer memfd.Close()
        }
        if memfd != nil {
                go memProfileLoop(memfd)
        }
func memProfileLoop(fd *os.File) {
        checkTicker := time.NewTicker(10 * time.Second)
        checkTickerChan := checkTicker.C
        for {
                select {
                case <-checkTickerChan:
                        if fd != nil {
                                //runtime.GC()
                                pprof.WriteHeapProfile(fd)
                                fd.Sync()
                        }
                }
        }
}

What did you see instead?

go tool pprof bin/dispatch memprofile
malformed profile: mismatch: sample has: 4 values vs. 1748 types

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions