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
Milestone

Comments

@OneOfOne
Copy link
Contributor

@OneOfOne OneOfOne commented Nov 22, 2019

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

This comment has been minimized.

Copy link
Contributor Author

@OneOfOne OneOfOne commented Nov 22, 2019

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

@randall77

This comment has been minimized.

Copy link
Contributor

@randall77 randall77 commented Nov 22, 2019

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

This comment has been minimized.

Copy link
Contributor Author

@OneOfOne OneOfOne commented Nov 22, 2019

Yep, 5.3.12-arch1-1 to be specific.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Nov 22, 2019

See also #35470.

@toothrot

This comment has been minimized.

Copy link
Contributor

@toothrot toothrot commented Nov 25, 2019

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

@cherrymui

This comment has been minimized.

Copy link
Contributor

@cherrymui cherrymui commented Dec 2, 2019

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

@cherrymui cherrymui closed this Dec 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.