The test suite (and my closed-source application that uses luar) crashes with go1.8:
tassadar@dorea:~/chadron-server/bin$ GODEBUG=gccheckmark=1 GOGC=1 GOROOT=/usr/local/go1.8/ /usr/local/go1.8/bin/go test github.com/stevedonovan/luar
runtime: marking free object 0xc420010800 found at *(0x0+0x0)
base=0x0 is not in the Go heap
obj=0xc420010800 k=0x6210008 s.base()=0xc420010000 s.limit=0xc420012000 s.sizeclass=2 s.elemsize=16 s.state=_MSpanInUse
*(obj+0) = 0xc4200107f0
*(obj+8) = 0x6
fatal error: marking free object
runtime stack:
runtime.throw(0x5b3d7c, 0x13)
/usr/local/go1.8/src/runtime/panic.go:596 +0x95
runtime.greyobject(0xc420010800, 0x0, 0x0, 0xc41ffff7bf, 0xc400000000, 0x7f74ff2ca2f8, 0xc420021228, 0x80)
/usr/local/go1.8/src/runtime/mgcmark.go:1388 +0x497
runtime.shade(0xc420010800)
/usr/local/go1.8/src/runtime/mgcmark.go:1342 +0xbd
runtime.gcmarkwb_m(0x14a2f60, 0xc420010728)
/usr/local/go1.8/src/runtime/mbarrier.go:154 +0xea
runtime.writebarrierptr_prewrite1.func1()
/usr/local/go1.8/src/runtime/mbarrier.go:188 +0x64
runtime.systemstack(0x7fffa875cd00)
/usr/local/go1.8/src/runtime/asm_amd64.s:327 +0x79
runtime.mstart()
/usr/local/go1.8/src/runtime/proc.go:1132
goroutine 67 [running, locked to thread]:
runtime.systemstack_switch()
/usr/local/go1.8/src/runtime/asm_amd64.s:281 fp=0xc4200e9708 sp=0xc4200e9700
runtime.writebarrierptr_prewrite1(0x14a2f60, 0xc420010728)
/usr/local/go1.8/src/runtime/mbarrier.go:189 +0xbf fp=0xc4200e9748 sp=0xc4200e9708
runtime.writebarrierptr(0x14a2f60, 0xc420010728)
/usr/local/go1.8/src/runtime/mbarrier.go:211 +0x4d fp=0xc4200e9780 sp=0xc4200e9748
github.com/stevedonovan/luar.makeValueProxy(0xc420018680, 0x587980, 0xc420010728, 0x82, 0x5b13c1, 0x8)
/home/tassadar/chadron-server/src/github.com/stevedonovan/luar/proxy.go:118 +0x31b fp=0xc4200e97e0 sp=0xc4200e9780
github.com/stevedonovan/luar.goToLua(0xc420018680, 0x0, 0x0, 0x587980, 0xc420010728, 0x82, 0x0, 0xc420018680, 0x1)
/home/tassadar/chadron-server/src/github.com/stevedonovan/luar/luar.go:497 +0x2f5 fp=0xc4200e9888 sp=0xc4200e97e0
github.com/stevedonovan/luar.GoToLua(0xc420018680, 0x0, 0x0, 0x587980, 0xc420010728, 0x82, 0x0)
/home/tassadar/chadron-server/src/github.com/stevedonovan/luar/luar.go:454 +0xaa fp=0xc4200e98f0 sp=0xc4200e9888
github.com/stevedonovan/luar.goLuaFunc.func1(0xc420018680, 0xc420018680)
/home/tassadar/chadron-server/src/github.com/stevedonovan/luar/luar.go:858 +0x35f fp=0xc4200e9a40 sp=0xc4200e98f0
github.com/aarzilli/golua/lua.golua_callgofunction(0xc420018680, 0x22, 0xc4200183d8)
/home/tassadar/chadron-server/src/github.com/aarzilli/golua/lua/golua.go:73 +0x6d fp=0xc4200e9a90 sp=0xc4200e9a40
github.com/aarzilli/golua/lua._cgoexpwrap_fb48268534f4_golua_callgofunction(0xc420018680, 0x22, 0x7f74feefd975)
github.com/aarzilli/golua/lua/_obj/_cgo_gotypes.go:1575 +0x35 fp=0xc4200e9ab8 sp=0xc4200e9a90
runtime.call32(0x0, 0x7fffa875c8d8, 0x7fffa875c970, 0x18)
/usr/local/go1.8/src/runtime/asm_amd64.s:514 +0x48 fp=0xc4200e9ae8 sp=0xc4200e9ab8
runtime.cgocallbackg1(0x0)
/usr/local/go1.8/src/runtime/cgocall.go:301 +0x19d fp=0xc4200e9b60 sp=0xc4200e9ae8
runtime.cgocallbackg(0x0)
/usr/local/go1.8/src/runtime/cgocall.go:184 +0x84 fp=0xc4200e9bc8 sp=0xc4200e9b60
runtime.cgocallback_gofunc(0x40655a, 0x558f80, 0xc4200e9c78, 0x40657c)
/usr/local/go1.8/src/runtime/asm_amd64.s:767 +0x74 fp=0xc4200e9be8 sp=0xc4200e9bc8
runtime.asmcgocall(0x558f80, 0xc4200e9c78)
/usr/local/go1.8/src/runtime/asm_amd64.s:614 +0x42 fp=0xc4200e9bf0 sp=0xc4200e9be8
runtime.cgocall(0x558f80, 0xc4200e9c78, 0x520100)
/usr/local/go1.8/src/runtime/cgocall.go:132 +0xfa fp=0xc4200e9c30 sp=0xc4200e9bf0
github.com/aarzilli/golua/lua._Cfunc_lua_pcall(0x7f74f8006200, 0xffffffff00000000, 0x2, 0x0)
github.com/aarzilli/golua/lua/_obj/_cgo_gotypes.go:1103 +0x4d fp=0xc4200e9c78 sp=0xc4200e9c30
github.com/aarzilli/golua/lua.(*State).pcall.func1(0x7f74f8006200, 0xffffffff00000000, 0x7f7400000002, 0x2)
/home/tassadar/chadron-server/src/github.com/aarzilli/golua/lua/lua.go:179 +0x78 fp=0xc4200e9cb0 sp=0xc4200e9c78
github.com/aarzilli/golua/lua.(*State).pcall(0xc420018680, 0x0, 0xffffffffffffffff, 0x2, 0x558590)
/home/tassadar/chadron-server/src/github.com/aarzilli/golua/lua/lua.go:179 +0x49 fp=0xc4200e9ce0 sp=0xc4200e9cb0
github.com/aarzilli/golua/lua.(*State).callEx(0xc420018680, 0x0, 0xffffffffffffffff, 0x14a2b01, 0x0, 0x0)
/home/tassadar/chadron-server/src/github.com/aarzilli/golua/lua/lua.go:198 +0xe3 fp=0xc4200e9d58 sp=0xc4200e9ce0
github.com/aarzilli/golua/lua.(*State).Call(0xc420018680, 0x0, 0xffffffffffffffff, 0x0, 0x0)
/home/tassadar/chadron-server/src/github.com/aarzilli/golua/lua/lua.go:211 +0x44 fp=0xc4200e9d98 sp=0xc4200e9d58
github.com/aarzilli/golua/lua.(*State).DoString(0xc420018680, 0x5bbc34, 0xb3, 0x0, 0x0)
/home/tassadar/chadron-server/src/github.com/aarzilli/golua/lua/lauxlib.go:107 +0x190 fp=0xc4200e9e08 sp=0xc4200e9d98
github.com/stevedonovan/luar.TestTypeDiscipline(0xc4200a2410)
/home/tassadar/chadron-server/src/github.com/stevedonovan/luar/luar_test.go:684 +0x339 fp=0xc4200e9fa8 sp=0xc4200e9e08
testing.tRunner(0xc4200a2410, 0x5bc978)
/usr/local/go1.8/src/testing/testing.go:657 +0x96 fp=0xc4200e9fd0 sp=0xc4200e9fa8
runtime.goexit()
/usr/local/go1.8/src/runtime/asm_amd64.s:2197 +0x1 fp=0xc4200e9fd8 sp=0xc4200e9fd0
created by testing.(*T).Run
/usr/local/go1.8/src/testing/testing.go:697 +0x2ca
goroutine 1 [chan receive]:
testing.(*T).Run(0xc4200a2270, 0x5b3833, 0x12, 0x5bc978, 0x88a301)
/usr/local/go1.8/src/testing/testing.go:698 +0x2f4
testing.runTests.func1(0xc4200a2270)
/usr/local/go1.8/src/testing/testing.go:882 +0x67
testing.tRunner(0xc4200a2270, 0xc4200e9de0)
/usr/local/go1.8/src/testing/testing.go:657 +0x96
testing.runTests(0xc42000cbe0, 0x877e20, 0x16, 0x16, 0xc42001c780)
/usr/local/go1.8/src/testing/testing.go:888 +0x2c1
testing.(*M).Run(0xc42003df20, 0xc4200e9f20)
/usr/local/go1.8/src/testing/testing.go:822 +0xfc
main.main()
github.com/stevedonovan/luar/_test/_testmain.go:138 +0xf7
goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/usr/local/go1.8/src/runtime/asm_amd64.s:2197 +0x1
FAIL github.com/stevedonovan/luar 0.053s
This is likely due to reflect.Value containing pointers to Go-allocated values. With GODEBUG=cgocheck=2:
tassadar@dorea:~/chadron-server/bin$ GODEBUG=cgocheck=2 GOGC=1 GOROOT=/usr/local/go1.8/ /usr/local/go1.8/bin/go test github.com/stevedonovan/luar
write of Go pointer 0xc4200100e0 to non-Go memory 0x7f2b24008f70
fatal error: Go pointer stored into non-Go memory
runtime stack:
runtime.throw(0x5b83fb, 0x24)
/usr/local/go1.8/src/runtime/panic.go:596 +0x95
runtime.cgoCheckWriteBarrier.func1()
/usr/local/go1.8/src/runtime/cgocheck.go:44 +0xb8
runtime.systemstack(0xc420026000)
/usr/local/go1.8/src/runtime/asm_amd64.s:327 +0x79
runtime.mstart()
/usr/local/go1.8/src/runtime/proc.go:1132
goroutine 34 [running]:
runtime.systemstack_switch()
/usr/local/go1.8/src/runtime/asm_amd64.s:281 fp=0xc420043ac8 sp=0xc420043ac0
runtime.cgoCheckWriteBarrier(0x7f2b24008f70, 0xc4200100e0)
/usr/local/go1.8/src/runtime/cgocheck.go:45 +0xb6 fp=0xc420043b00 sp=0xc420043ac8
runtime.writebarrierptr(0x7f2b24008f70, 0xc4200100e0)
/usr/local/go1.8/src/runtime/mbarrier.go:199 +0xcc fp=0xc420043b38 sp=0xc420043b00
github.com/stevedonovan/luar.makeValueProxy(0xc4200188c0, 0x5766a0, 0xc4200100e0, 0x82, 0x5b1fdc, 0xb)
/home/tassadar/chadron-server/src/github.com/stevedonovan/luar/proxy.go:118 +0x31b fp=0xc420043b98 sp=0xc420043b38
github.com/stevedonovan/luar.goToLua(0xc4200188c0, 0x0, 0x0, 0x5766a0, 0xc4200100e0, 0x82, 0x52e300, 0xc4200188c0, 0x1)
/home/tassadar/chadron-server/src/github.com/stevedonovan/luar/luar.go:484 +0xe9b fp=0xc420043c40 sp=0xc420043b98
github.com/stevedonovan/luar.GoToLua(0xc4200188c0, 0x0, 0x0, 0x5766a0, 0xc4200100e0, 0x82, 0xc420043d00)
/home/tassadar/chadron-server/src/github.com/stevedonovan/luar/luar.go:454 +0xaa fp=0xc420043ca8 sp=0xc420043c40
github.com/stevedonovan/luar.Register(0xc4200188c0, 0x5b0827, 0x4, 0xc4200163c0)
/home/tassadar/chadron-server/src/github.com/stevedonovan/luar/luar.go:901 +0x120 fp=0xc420043d68 sp=0xc420043ca8
github.com/stevedonovan/luar.Init(0xc420010278)
/home/tassadar/chadron-server/src/github.com/stevedonovan/luar/luar.go:1194 +0x776 fp=0xc420043de0 sp=0xc420043d68
github.com/stevedonovan/luar.TestGoFunCall(0xc4200ae1a0)
/home/tassadar/chadron-server/src/github.com/stevedonovan/luar/luar_test.go:80 +0xe3 fp=0xc420043fa8 sp=0xc420043de0
testing.tRunner(0xc4200ae1a0, 0x5bc8f8)
/usr/local/go1.8/src/testing/testing.go:657 +0x96 fp=0xc420043fd0 sp=0xc420043fa8
runtime.goexit()
/usr/local/go1.8/src/runtime/asm_amd64.s:2197 +0x1 fp=0xc420043fd8 sp=0xc420043fd0
created by testing.(*T).Run
/usr/local/go1.8/src/testing/testing.go:697 +0x2ca
goroutine 1 [chan receive]:
testing.(*T).Run(0xc4200ae0d0, 0x5b263f, 0xd, 0x5bc8f8, 0x88a380)
/usr/local/go1.8/src/testing/testing.go:698 +0x2f4
testing.runTests.func1(0xc4200ae0d0)
/usr/local/go1.8/src/testing/testing.go:882 +0x67
testing.tRunner(0xc4200ae0d0, 0xc4200d5de0)
/usr/local/go1.8/src/testing/testing.go:657 +0x96
testing.runTests(0xc42000c480, 0x877e20, 0x16, 0x16, 0xc42001c280)
/usr/local/go1.8/src/testing/testing.go:888 +0x2c1
testing.(*M).Run(0xc4200d5f20, 0xc4200d5f20)
/usr/local/go1.8/src/testing/testing.go:822 +0xfc
main.main()
github.com/stevedonovan/luar/_test/_testmain.go:138 +0xf7
goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/usr/local/go1.8/src/runtime/asm_amd64.s:2197 +0x1
FAIL github.com/stevedonovan/luar 0.012s