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

runtime: goroutine stack exceeds 1000000000-byte limit #35784

Closed
OneOfOne opened this issue Nov 22, 2019 · 6 comments
Closed

runtime: goroutine stack exceeds 1000000000-byte limit #35784

OneOfOne opened this issue Nov 22, 2019 · 6 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@OneOfOne
Copy link
Contributor

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

$ go version
go version devel +1c5bd3459b 2019-11-22 16:04:32 +0000 linux/amd64

Does this issue reproduce with the latest release?

No, just tip as of ~ 2 weeks ago.

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

go env Output
$ go env
GO111MODULE="off"
GOARCH="amd64"
GOBIN="/home/oneofone/code/go/bin"
GOCACHE="/tmp/.gocache"
GOENV="/home/oneofone/.config/go/env"
GOEXE=""
GOFLAGS="-gcflags=-c=16"
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/oneofone/code/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/src/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/src/go/pkg/tool/linux_amd64"
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 -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build130861294=/tmp/go-build -gno-record-gcc-switches"
GOROOT/bin/go version: go version devel +1c5bd3459b 2019-11-22 16:04:32 +0000 linux/amd64
GOROOT/bin/go tool compile -V: compile version devel +1c5bd3459b 2019-11-22 16:04:32 +0000
uname -sr: Linux 5.3.12-arch1-1
LSB Version:	1.4
Distributor ID:	Arch
Description:	Arch Linux
Release:	rolling
Codename:	n/a
/usr/lib/libc.so.6: GNU C Library (GNU libc) stable release version 2.30.
lldb --version: lldb version 9.0.0
gdb --version: GNU gdb (GDB) 8.3.1

What did you do?

func flyGziper(r io.Reader) io.ReadCloser {
	pr, pw := io.Pipe()
	go func() {
		gw, _ := gzip.NewWriterLevel(pw, gzip.BestCompression) // only error is returned if level is wrong
		if _, err := io.Copy(gw, r); err != nil {
			pw.CloseWithError(err)
		} else {
			pw.CloseWithError(gw.Close())
		}

	}()
	return pr
}

What did you expect to see?

No crash, this code haven't changed in probably over 2 years and it doesn't use any unsafe code.

What did you see instead?

runtime: goroutine stack exceeds 1000000000-byte limit
fatal error: stack overflow

runtime stack:
runtime.throw(0x109e801, 0xe)
        /usr/src/go/src/runtime/panic.go:1106 +0x72
runtime.newstack()
        /usr/src/go/src/runtime/stack.go:1033 +0x60c
runtime.morestack()
        /usr/src/go/src/runtime/asm_amd64.s:449 +0x8f

goroutine 10390 [running]:
compress/flate.(*compressor).findMatch(0xc014ad8000, 0x8a5e, 0x8a22, 0x3, 0x75a2, 0x63, 0x31c2, 0x8001)
        /usr/src/go/src/compress/flate/deflate.go:233 +0x381 fp=0xc09c7fbde8 sp=0xc09c7fbde0 pc=0x6ad521
compress/flate.(*compressor).deflate(0xc014ad8000)
        /usr/src/go/src/compress/flate/deflate.go:443 +0x7d9 fp=0xc09c7fbe58 sp=0xc09c7fbde8 pc=0x6ae279
compress/flate.(*compressor).write(0xc014ad8000, 0xc0081b8000, 0x8000, 0x8000, 0x8000, 0xcac6dc23, 0x0)
        /usr/src/go/src/compress/flate/deflate.go:554 +0x83 fp=0xc09c7fbe98 sp=0xc09c7fbe58 pc=0x6ae793
compress/flate.(*Writer).Write(...)
        /usr/src/go/src/compress/flate/deflate.go:712
compress/gzip.(*Writer).Write(0xc001e34000, 0xc0081b8000, 0x8000, 0x8000, 0x8000, 0x0, 0x0)
        /usr/src/go/src/compress/gzip/gzip.go:196 +0xc1 fp=0xc09c7fbee8 sp=0xc09c7fbe98 pc=0x6bb341
io.copyBuffer(0x12f64c0, 0xc001e34000, 0x7f262477d4d0, 0xc002df6180, 0xc0081b8000, 0x8000, 0x8000, 0xc050ea5180, 0xc050ea51d0, 0xc050ea5220)
        /usr/src/go/src/io/io.go:407 +0x1fb fp=0xc09c7fbf60 sp=0xc09c7fbee8 pc=0x47584b
io.Copy(...)
        /usr/src/go/src/io/io.go:364
*trimmed*/archiver.flyGziper.func1(0xc036022088, 0x7f262477d4d0, 0xc002df6180)
        /home/oneofone/code/go/src/*trimmed*/archiver/utils.go:185 +0x88 fp=0xc09c7fbfc8 sp=0xc09c7fbf60 pc=0xa26208
runtime.goexit()
        /usr/src/go/src/runtime/asm_amd64.s:1375 +0x1 fp=0xc09c7fbfd0 sp=0xc09c7fbfc8 pc=0x467861
created by *trimmed*/archiver.flyGziper
        /home/oneofone/code/go/src/*trimmed*/archiver/utils.go:183 +0x152
@OneOfOne
Copy link
Contributor Author

I can't reproduce reliably, sometimes after 1 hour, sometimes takes 20+ hours, could be related to #35777.

@randall77
Copy link
Contributor

This is clearly not a real stack overflow, so yes it looks like something corrupting the stack bound. That could be #35777. Are you on a 5.3 kernel?

@OneOfOne
Copy link
Contributor Author

Yep, 5.3.12-arch1-1 to be specific.

@ianlancetaylor
Copy link
Contributor

See also #35470.

@toothrot toothrot added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Nov 25, 2019
@toothrot toothrot added this to the Go1.14 milestone Nov 25, 2019
@toothrot
Copy link
Contributor

Marking this as Go1.14 to be consistent with #35470, please correct me if I am mistaken @ianlancetaylor @cherrymui

@cherrymui
Copy link
Member

Closing as #35470 is closed. If this turns out to be different, we can reopen.

@golang golang locked and limited conversation to collaborators Dec 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

6 participants