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

internal/poll: invalid memory address in BenchmarkSplicePipe with race enabled #45520

Closed
perillo opened this issue Apr 12, 2021 · 3 comments
Closed

Comments

@perillo
Copy link
Contributor

perillo commented Apr 12, 2021

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

$ go version
go version devel go1.17-16cd770e06 Mon Apr 12 05:12:42 2021 +0000 linux/amd64

Does this issue reproduce with the latest release?

This issue reproduces with the current master.

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

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN="/home/manlio/.local/bin"
GOCACHE="/home/manlio/.cache/go-build"
GOENV="/home/manlio/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE="*.local"
GOMODCACHE="/home/manlio/.local/lib/go/pkg/mod"
GONOPROXY=""
GONOSUMDB="*.local"
GOOS="linux"
GOPATH="/home/manlio/.local/lib/go:/home/manlio/src/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/manlio/src/contrib/go/go.googlesource.com/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/manlio/src/contrib/go/go.googlesource.com/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.3"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/manlio/src/contrib/go/go.googlesource.com/go/src/go.mod"
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-build2510374715=/tmp/go-build -gno-record-gcc-switches"
GOROOT/bin/go version: go version devel go1.17-16cd770e06 Mon Apr 12 05:12:42 2021 +0000 linux/amd64
GOROOT/bin/go tool compile -V: compile version devel go1.17-16cd770e06 Mon Apr 12 05:12:42 2021 +0000
uname -sr: Linux 5.11.11-arch1-1
/usr/lib/libc.so.6: GNU C Library (GNU libc) release release version 2.33.
gdb --version: GNU gdb (GDB) 10.1

What did you do?

From the go src directory:

../bin/go test -race -bench=BenchmarkSplicePipe internal/poll

What did you expect to see?

PASS

What did you see instead?

goos: linux
goarch: amd64
pkg: internal/poll
cpu: Intel(R) Core(TM) i5-4460  CPU @ 3.20GHz
BenchmarkSplicePipe/SplicePipeWithPool-4         	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4cc5b4]

goroutine 67 [running]:
panic(0x5c1e60, 0x6f3800)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/panic.go:1141 +0x465 fp=0xc000047d08 sp=0xc000047c30 pc=0x46afa5
runtime.panicmem(...)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/panic.go:214
runtime.sigpanic()
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/signal_unix.go:735 +0x40e fp=0xc000047d68 sp=0xc000047d08 pc=0x4848ae
internal/poll.putPipe(0x0)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/internal/poll/splice_linux.go:193 +0x34 fp=0xc000047d98 sp=0xc000047d68 pc=0x4cc5b4
internal/poll_test.BenchmarkSplicePipe.func1(0xc00014a480)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/internal/poll/splice_linux_test.go:79 +0x7f fp=0xc000047de0 sp=0xc000047d98 pc=0x5a7a9f
testing.(*B).runN(0xc00014a480, 0x2710)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/testing/benchmark.go:192 +0x1c6 fp=0xc000047f00 sp=0xc000047de0 pc=0x522686
testing.(*B).launch(0xc00014a480)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/testing/benchmark.go:325 +0x37f fp=0xc000047fd8 sp=0xc000047f00 pc=0x5239df
runtime.goexit()
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/asm_amd64.s:1500 +0x1 fp=0xc000047fe0 sp=0xc000047fd8 pc=0x4a2861
created by testing.(*B).doBench
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/testing/benchmark.go:280 +0x78

goroutine 1 [chan receive]:
runtime.gopark(0x5f4500, 0xc000096118, 0x170e, 0x2)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/proc.go:334 +0x105 fp=0xc0000bb6c0 sp=0xc0000bb6a0 pc=0x46e485
runtime.chanrecv(0xc0000960c0, 0x0, 0xc000000101, 0x522976)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/chan.go:576 +0x58b fp=0xc0000bb750 sp=0xc0000bb6c0 pc=0x438feb
runtime.chanrecv1(0xc0000960c0, 0x0)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/chan.go:439 +0x2b fp=0xc0000bb780 sp=0xc0000bb750 pc=0x438a4b
testing.(*B).run1(0xc00014a240, 0x10)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/testing/benchmark.go:234 +0x16f fp=0xc0000bb878 sp=0xc0000bb780 pc=0x5229af
testing.(*B).Run(0xc00014a000, 0x5eca22, 0x13, 0x5f4340, 0x6fc900)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/testing/benchmark.go:667 +0x956 fp=0xc0000bba18 sp=0xc0000bb878 pc=0x527156
testing.runBenchmarks.func1(0xc00014a000)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/testing/benchmark.go:541 +0xbf fp=0xc0000bba70 sp=0xc0000bba18 pc=0x52569f
testing.(*B).runN(0xc00014a000, 0x1)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/testing/benchmark.go:192 +0x1c6 fp=0xc0000bbb90 sp=0xc0000bba70 pc=0x522686
testing.runBenchmarks(0x5eb5b8, 0xd, 0xc00000e288, 0x6f8100, 0x3, 0x3, 0x6fc920)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/testing/benchmark.go:550 +0x916 fp=0xc0000bbd10 sp=0xc0000bbb90 pc=0x525196
testing.(*M).Run(0xc0000e0000, 0x0)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/testing/testing.go:1465 +0x788 fp=0xc0000bbf00 sp=0xc0000bbd10 pc=0x5326c8
main.main()
	_testmain.go:71 +0x285 fp=0xc0000bbf88 sp=0xc0000bbf00 pc=0x5a84c5
runtime.main()
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/proc.go:223 +0x248 fp=0xc0000bbfe0 sp=0xc0000bbf88 pc=0x46e008
runtime.goexit()
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/asm_amd64.s:1500 +0x1 fp=0xc0000bbfe8 sp=0xc0000bbfe0 pc=0x4a2861

goroutine 2 [force gc (idle)]:
runtime.gopark(0x5f4778, 0x6fc3f0, 0x1411, 0x1)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/proc.go:334 +0x105 fp=0xc000036fb0 sp=0xc000036f90 pc=0x46e485
runtime.goparkunlock(...)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/proc.go:340
runtime.forcegchelper()
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/proc.go:274 +0xc5 fp=0xc000036fe0 sp=0xc000036fb0 pc=0x46e2e5
runtime.goexit()
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/asm_amd64.s:1500 +0x1 fp=0xc000036fe8 sp=0xc000036fe0 pc=0x4a2861
created by runtime.init.6
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/proc.go:262 +0x35

goroutine 3 [GC sweep wait]:
runtime.gopark(0x5f4778, 0x6fc5c0, 0x140c, 0x1)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/proc.go:334 +0x105 fp=0xc0000377b0 sp=0xc000037790 pc=0x46e485
runtime.goparkunlock(...)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/proc.go:340
runtime.bgsweep()
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/mgcsweep.go:182 +0xfb fp=0xc0000377e0 sp=0xc0000377b0 pc=0x4573db
runtime.goexit()
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/asm_amd64.s:1500 +0x1 fp=0xc0000377e8 sp=0xc0000377e0 pc=0x4a2861
created by runtime.gcenable
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/mgc.go:221 +0x75

goroutine 4 [sleep]:
runtime.gopark(0x5f4778, 0x6fc6e0, 0x461313, 0x2)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/proc.go:334 +0x105 fp=0xc000037f48 sp=0xc000037f28 pc=0x46e485
runtime.goparkunlock(...)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/proc.go:340
runtime.scavengeSleep(0xa8461, 0x108e5e)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/mgcscavenge.go:241 +0x92 fp=0xc000037f80 sp=0xc000037f48 pc=0x455112
runtime.bgscavenge()
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/mgcscavenge.go:366 +0x225 fp=0xc000037fe0 sp=0xc000037f80 pc=0x455365
runtime.goexit()
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/asm_amd64.s:1500 +0x1 fp=0xc000037fe8 sp=0xc000037fe0 pc=0x4a2861
created by runtime.gcenable
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/mgc.go:222 +0x8d

goroutine 18 [finalizer wait]:
runtime.gopark(0x5f4778, 0x729bf8, 0xc0001a1410, 0x1)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/proc.go:334 +0x105 fp=0xc000036740 sp=0xc000036720 pc=0x46e485
runtime.goparkunlock(...)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/proc.go:340
runtime.runfinq()
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/mfinal.go:177 +0xc6 fp=0xc0000367e0 sp=0xc000036740 pc=0x44bfa6
runtime.goexit()
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/asm_amd64.s:1500 +0x1 fp=0xc0000367e8 sp=0xc0000367e0 pc=0x4a2861
created by runtime.createfing
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/mfinal.go:157 +0x57

goroutine 29 [runnable]:
runtime.gopark(0x5f4500, 0xc000096178, 0xc0000b170e, 0x2)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/proc.go:334 +0x105 fp=0xc0000b9938 sp=0xc0000b9918 pc=0x46e485
runtime.chanrecv(0xc000096120, 0x0, 0xc000083601, 0x5235b8)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/chan.go:576 +0x58b fp=0xc0000b99c8 sp=0xc0000b9938 pc=0x438feb
runtime.chanrecv1(0xc000096120, 0x0)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/chan.go:439 +0x2b fp=0xc0000b99f8 sp=0xc0000b99c8 pc=0x438a4b
testing.(*B).doBench(0xc00014a480, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/testing/benchmark.go:281 +0xad fp=0xc0000b9a20 sp=0xc0000b99f8 pc=0x5235ed
testing.(*benchContext).processBench(0xc00000e2a0, 0xc00014a480)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/testing/benchmark.go:580 +0x7f5 fp=0xc0000b9c10 sp=0xc0000b9a20 pc=0x525eb5
testing.(*B).run(0xc00014a480)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/testing/benchmark.go:272 +0xbf fp=0xc0000b9c70 sp=0xc0000b9c10 pc=0x52321f
testing.(*B).Run(0xc00014a240, 0x5ec6db, 0x12, 0x5f4310, 0xc00014a400)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/testing/benchmark.go:668 +0x96e fp=0xc0000b9e10 sp=0xc0000b9c70 pc=0x52716e
internal/poll_test.BenchmarkSplicePipe(0xc00014a240)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/internal/poll/splice_linux_test.go:76 +0x5e fp=0xc0000b9e48 sp=0xc0000b9e10 pc=0x5a5dbe
testing.(*B).runN(0xc00014a240, 0x1)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/testing/benchmark.go:192 +0x1c6 fp=0xc0000b9f68 sp=0xc0000b9e48 pc=0x522686
testing.(*B).run1.func1(0xc00014a240)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/testing/benchmark.go:232 +0x76 fp=0xc0000b9fd8 sp=0xc0000b9f68 pc=0x523096
runtime.goexit()
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/asm_amd64.s:1500 +0x1 fp=0xc0000b9fe0 sp=0xc0000b9fd8 pc=0x4a2861
created by testing.(*B).run1
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/testing/benchmark.go:225 +0x136

goroutine 52 [GC worker (idle)]:
runtime.gopark(0x5f45a8, 0xc0001c03a0, 0x1418, 0x0)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/proc.go:334 +0x105 fp=0xc00045cf60 sp=0xc00045cf40 pc=0x46e485
runtime.gcBgMarkWorker()
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/mgc.go:1917 +0x118 fp=0xc00045cfe0 sp=0xc00045cf60 pc=0x450058
runtime.goexit()
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/asm_amd64.s:1500 +0x1 fp=0xc00045cfe8 sp=0xc00045cfe0 pc=0x4a2861
created by runtime.gcBgMarkStartWorkers
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/mgc.go:1841 +0x37

goroutine 51 [GC worker (idle)]:
runtime.gopark(0x5f45a8, 0xc0001c0380, 0x1418, 0x0)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/proc.go:334 +0x105 fp=0xc00045c760 sp=0xc00045c740 pc=0x46e485
runtime.gcBgMarkWorker()
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/mgc.go:1917 +0x118 fp=0xc00045c7e0 sp=0xc00045c760 pc=0x450058
runtime.goexit()
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/asm_amd64.s:1500 +0x1 fp=0xc00045c7e8 sp=0xc00045c7e0 pc=0x4a2861
created by runtime.gcBgMarkStartWorkers
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/mgc.go:1841 +0x37

goroutine 28 [GC worker (idle)]:
runtime.gopark(0x5f45a8, 0xc0001389a0, 0x1418, 0x0)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/proc.go:334 +0x105 fp=0xc000032f60 sp=0xc000032f40 pc=0x46e485
runtime.gcBgMarkWorker()
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/mgc.go:1917 +0x118 fp=0xc000032fe0 sp=0xc000032f60 pc=0x450058
runtime.goexit()
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/asm_amd64.s:1500 +0x1 fp=0xc000032fe8 sp=0xc000032fe0 pc=0x4a2861
created by runtime.gcBgMarkStartWorkers
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/mgc.go:1841 +0x37

goroutine 50 [GC worker (idle)]:
runtime.gopark(0x5f45a8, 0xc000138980, 0x1418, 0x0)
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/proc.go:334 +0x105 fp=0xc000038f60 sp=0xc000038f40 pc=0x46e485
runtime.gcBgMarkWorker()
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/mgc.go:1917 +0x118 fp=0xc000038fe0 sp=0xc000038f60 pc=0x450058
runtime.goexit()
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/asm_amd64.s:1500 +0x1 fp=0xc000038fe8 sp=0xc000038fe0 pc=0x4a2861
created by runtime.gcBgMarkStartWorkers
	/home/manlio/src/contrib/go/go.googlesource.com/go/src/runtime/mgc.go:1841 +0x37
exit status 2
FAIL	internal/poll	12.249s
FAIL
@ianlancetaylor
Copy link
Contributor

CC @panjf2000

@gopherbot
Copy link

Change https://golang.org/cl/309429 mentions this issue: internal/poll: ensure that newPoolPipe doesn't return a nil pointer

@gopherbot
Copy link

Change https://golang.org/cl/309449 mentions this issue: internal/poll: fix the nil pointer dereference in BenchmarkSplicePipe with race enabled

@golang golang locked and limited conversation to collaborators Apr 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants