Skip to content

runtime: slowdown on arm64 in GC while scanning stacks #37779

Closed
@shawndx

Description

@shawndx

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

$ go version
go version devel +92d1fb7cb4 Tue Mar 10 00:47:23 2020 +0000 linux/arm64

Does this issue reproduce with the latest release?

Yes, reproducible with go1.14

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

go env Output
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/home/xiaji01/.cache/go-build"
GOENV="/home/xiaji01/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/xiaji01/.go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/xiaji01/util/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/xiaji01/util/go/pkg/tool/linux_arm64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build683441384=/tmp/go-build -gno-record-gcc-switches"

What did you do?

// main.go
package main

import (
"time"
)

func sst(n int) {
timers := make([]*time.Timer, n)
for i := 0; i < n; i++ {
timers[i] = time.AfterFunc(time.Hour, nil)
}

    for i := 0; i < n; i++ {
            timers[i].Stop()
    }

}

func SST() {
sst(2<<15)
sst(2<<18)
}

func main() {
SST()
}

$ go build ./main.go
$ time -p ./main // run a few times

The execution time should be a few hundreds of milliseconds, while sometimes it may take dozens of, or 100 plus seconds to finish.

good:
real 0.42
user 0.64
sys 0.73

bad:
real 38.11
user 28.41
sys 48.71

What did you expect to see?

The program shall finish quickly.

What did you see instead?

Considerably long latency (in GC).

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