-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
reflect: TestStructOfWithInterface failure with cgocheck=2 #23899
Comments
This is because It may work to simply add a |
Change https://golang.org/cl/95676 mentions this issue: |
I'm concerned that this bug indicates a deeper problem when using types generated by reflect. We can create itab entries for such types, but the itabs are allocated using |
I no longer think that the previous comment is a concern, because the reflect package keeps a cache of generated types, so they will never be garbage collected. |
Change https://golang.org/cl/155697 mentions this issue: |
Assigning to @aclements for review of CL 155697. |
related issues: golang/go#23899, golang/go#28458, golang/go#27660 Update #3
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.10 freebsd/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOCACHE="/home/sternix/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="freebsd"
GOOS="freebsd"
GOPATH="/home/sternix/go"
GORACE=""
GOROOT="/opt/go/1_10/go"
GOTMPDIR=""
GOTOOLDIR="/opt/go/1_10/go/pkg/tool/freebsd_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build875902433=/tmp/go-build -gno-record-gcc-switches"
What did you do?
i install go to the directory /opt/go/1_10
and set env variable GODEBUG cgocheck=2
cd /opt/go/1_10/go/src/reflect
go test -v .
....
=== RUN TestStructOfWithInterface
write of Go pointer 0xc4203a0000 to non-Go memory 0x800bd15d0
fatal error: Go pointer stored into non-Go memory
runtime stack:
runtime.throw(0x6337d9, 0x24)
/opt/go/1_10/go/src/runtime/panic.go:619 +0x81
runtime.cgoCheckWriteBarrier.func1()
/opt/go/1_10/go/src/runtime/cgocheck.go:48 +0xa9
runtime.systemstack(0x0)
/opt/go/1_10/go/src/runtime/asm_amd64.s:409 +0x79
runtime.mstart()
/opt/go/1_10/go/src/runtime/proc.go:1170
goroutine 58 [running]:
runtime.systemstack_switch()
/opt/go/1_10/go/src/runtime/asm_amd64.s:363 fp=0xc420071920 sp=0xc420071918 pc=0x455e90
runtime.cgoCheckWriteBarrier(0x800bd15d0, 0xc4203a0000)
/opt/go/1_10/go/src/runtime/cgocheck.go:46 +0xaa fp=0xc420071958 sp=0xc420071920 pc=0x40299a
runtime.wbBufFlush(0x800bd15d0, 0xc4203a0000)
/opt/go/1_10/go/src/runtime/mwbbuf.go:169 +0x6b fp=0xc420071978 sp=0xc420071958 pc=0x426d7b
runtime.gcWriteBarrier(0x20, 0x0, 0x9b0e60, 0x800bd15c8, 0xc420466fc0, 0x199, 0xc4203a0000, 0xc420466fc8, 0x4af056, 0x5e6bc0, ...)
/opt/go/1_10/go/src/runtime/asm_amd64.s:2442 +0xb4 fp=0xc420071a00 sp=0xc420071978 pc=0x458a34
runtime.getitab(0x5ef920, 0xc4203a0000, 0xc4203a0001, 0xc420466fc8)
/opt/go/1_10/go/src/runtime/iface.go:68 +0x43b fp=0xc420071a78 sp=0xc420071a00 pc=0x40d17b
runtime.assertE2I2(0x5ef920, 0xc4203a0000, 0xc420466fc8, 0xc4203a0000, 0xc420466fc8, 0x82)
/opt/go/1_10/go/src/runtime/iface.go:592 +0x43 fp=0xc420071aa8 sp=0xc420071a78 pc=0x40e5c3
reflect_test.TestStructOfWithInterface(0xc4200ac4b0)
/opt/go/1_10/go/src/reflect/all_test.go:4890 +0x742 fp=0xc420071fa8 sp=0xc420071aa8 pc=0x56f2e2
testing.tRunner(0xc4200ac4b0, 0x639640)
/opt/go/1_10/go/src/testing/testing.go:777 +0xd0 fp=0xc420071fd0 sp=0xc420071fa8 pc=0x4dd920
runtime.goexit()
/opt/go/1_10/go/src/runtime/asm_amd64.s:2361 +0x1 fp=0xc420071fd8 sp=0xc420071fd0 pc=0x458971
created by testing.(*T).Run
/opt/go/1_10/go/src/testing/testing.go:824 +0x2e0
goroutine 1 [chan receive]:
testing.(*T).Run(0xc4200ac4b0, 0x62fb4f, 0x19, 0x639640, 0x1)
/opt/go/1_10/go/src/testing/testing.go:825 +0x301
testing.runTests.func1(0xc4200ac000)
/opt/go/1_10/go/src/testing/testing.go:1063 +0x64
testing.tRunner(0xc4200ac000, 0xc42003ddf8)
/opt/go/1_10/go/src/testing/testing.go:777 +0xd0
testing.runTests(0xc42000a540, 0x98c240, 0x8e, 0x8e, 0x40fc01)
/opt/go/1_10/go/src/testing/testing.go:1061 +0x2c4
testing.(*M).Run(0xc4200a8000, 0x0)
/opt/go/1_10/go/src/testing/testing.go:978 +0x171
main.main()
_testmain.go:354 +0x151
goroutine 45 [sleep]:
time.Sleep(0x3b9aca00)
/opt/go/1_10/go/src/runtime/time.go:102 +0x166
reflect_test.selectWatcher()
/opt/go/1_10/go/src/reflect/all_test.go:1541 +0x40
created by reflect_test.TestSelect.func1
/opt/go/1_10/go/src/reflect/all_test.go:1271 +0x35
FAIL reflect 1.594s
What did you expect to see?
SUCCESS
What did you see instead?
FAIL
The text was updated successfully, but these errors were encountered: