Hello,

I'm seeing a panic in go version go1.8rc3 linux/amd64 while trying to write 
a database driver using cgo. The go code runs in a docker container, the 
database in another.

Generally it works reliably, but occasionally, during repeated retrieval of 
binary data (photos approx 100K to 2M), the code panics.

I haven't isolated a reproducible example, but I think it's related to this 
code:


value := new(C.a_sqlany_data_value)

//load the column value binary data into value.buffer

C.sqlany_get_column(r.stmt.ptr, C.sacapi_u32(i), value)


//copy the value buffer from C to Go

val = C.GoBytes(unsafe.Pointer(value.buffer), C.int(value.length))


I haven't seen the panic if the last line is commented out.

Below is a stack trace. Perhaps it panics when a garbage collection is 
triggered while waiting for C.GoBytes to return?

Any suggestions?

Thank you,
Mark

 

runtime: unexpected return pc for runtime.sigpanic called from 0xc420e1a000
fatal error: unknown caller pc

runtime stack:
runtime.throw(0x59a90e, 0x11)
/go/src/runtime/panic.go:596 +0x95
runtime.gentraceback(0xffffffffffffffff, 0xc42002a5d8, 0x0, 0xc4200c49c0, 
0x0, 0x0, 0x7fffffff, 0x7fb675ad5cb8, 0x0, 0x0, ...)
/go/src/runtime/traceback.go:317 +0x13ea
runtime.scanstack(0xc4200c49c0, 0xc420021828)
/go/src/runtime/mgcmark.go:842 +0x265
runtime.newstack(0x0)
/go/src/runtime/stack.go:1064 +0x41e
runtime.morestack()
/go/src/runtime/asm_amd64.s:398 +0x86

goroutine 11 [GC worker (idle) (scan)]:
runtime.assertE2I2(0x56c220, 0x569e20, 0x841d20, 0xc42002a6b0, 
0xc4200c49e0, 0xc42002a640)
/go/src/runtime/iface.go:289 +0xb2 fp=0xc42002a5e0 sp=0xc42002a5d8
runtime.preprintpanics(0xc42002a6b0)
/go/src/runtime/panic.go:389 +0x9f fp=0xc42002a650 sp=0xc42002a5e0
panic(0x569e20, 0x841d20)
/go/src/runtime/panic.go:528 +0x1ab fp=0xc42002a6e8 sp=0xc42002a650
runtime.panicmem()
/go/src/runtime/panic.go:63 +0x5e fp=0xc42002a708 sp=0xc42002a6e8
runtime.sigpanic()
/go/src/runtime/signal_unix.go:290 +0x29f fp=0xc42002a758 sp=0xc42002a708
created by runtime.gcBgMarkStartWorkers
/go/src/runtime/mgc.go:1410 +0x98

goroutine 1 [chan receive]:
testing.(*T).Run(0xc420072820, 0x598622, 0x8, 0x5a3718, 0xc420051d01)
/go/src/testing/testing.go:698 +0x2f4
testing.runTests.func1(0xc420072820)
/go/src/testing/testing.go:881 +0x67
testing.tRunner(0xc420072820, 0xc420051de0)
/go/src/testing/testing.go:657 +0x96
testing.runTests(0xc42000cb60, 0x8461e0, 0x4, 0x4, 0xc420051ef8)
/go/src/testing/testing.go:887 +0x2c1
testing.(*M).Run(0xc420051f20, 0xc420051f20)
/go/src/testing/testing.go:822 +0xfc
main.main()
github.com/mdcnz/sqlanywhere/_test/_testmain.go:48 +0xf7

goroutine 17 [syscall, 6 minutes, locked to thread]:
runtime.goexit()
/go/src/runtime/asm_amd64.s:2197 +0x1

goroutine 231 [GC assist wait]:
database/sql.convertAssign(0x5517a0, 0xc4200c20a0, 0x55a040, 0xc42000c0e0, 
0x85b5c0, 0x4535c0)
/go/src/database/sql/convert.go:161 +0x1a22
database/sql.(*Rows).Scan(0xc42001c6c0, 0xc420041f68, 0x1, 0x1, 0x0, 0x0)
/go/src/database/sql/sql.go:2342 +0xca
github.com/mdcnz/sqlanywhere.TestBlob(0xc4200728f0)
/root/gome/src/github.com/mdcnz/sqlanywhere/test.go:26 +0x2a5
testing.tRunner(0xc4200728f0, 0x5a3718)
/go/src/testing/testing.go:657 +0x96
created by testing.(*T).Run
/go/src/testing/testing.go:697 +0x2ca

goroutine 233 [chan receive]:
database/sql.(*Rows).awaitDone(0xc42001c6c0, 0x84b240, 0xc42047e080)
/go/src/database/sql/sql.go:2091 +0x54
created by database/sql.(*Rows).initContextClose
/go/src/database/sql/sql.go:2086 +0x92

goroutine 232 [chan receive]:
database/sql.(*DB).connectionOpener(0xc42008c210)
/go/src/database/sql/sql.go:835 +0x4a
created by database/sql.Open
/go/src/database/sql/sql.go:580 +0x1c8
exit status 2

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to