I just had a fairly strange not reproducible panic. I have no idea whether 
this could be a go bug or if the C library I am using is buggy. In case it 
looks like a go bug I should probably post this on the issue tracker. Does 
anyone have an idea whether this is useful or if I should just forget about 
it? This is what the bug report would look like:

I build and ran a go program whose code I unfortunately can't share. The 
program uses a go library called def (see stacktrace) which makes extensive 
use of cgo. The line where it panics "def/instance.go:353" contains only an 
assignment. The assignment is of the form *X.Y, where Y is a pointer to 
space on the C heap that is allocated in the previous line.

This happened once and never again. The program and go library are strictly 
single threaded. I don't know much about the C code around it though.

### What version of Go are you using (`go version`)?
$ go version
go version go1.7.3 linux/amd64

### What operating system and processor architecture are you using (`go 
env`)?
$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/florian/go"
GORACE=""
GOROOT="/usr/lib/go-1.7"
GOTOOLDIR="/usr/lib/go-1.7/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 
-fdebug-prefix-map=/tmp/go-build640009790=/tmp/go-build 
-gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

### Stacktrace
runtime: writebarrierptr *0x7fbca8000960 = 0x1
fatal error: bad pointer in write barrier

runtime stack:
runtime.throw(0x55fdd48b2bd2, 0x1c)
        /usr/lib/go-1.7/src/runtime/panic.go:566 +0x95
runtime.writebarrierptr.func1()
        /usr/lib/go-1.7/src/runtime/mbarrier.go:151 +0xbd
runtime.systemstack(0xc42001c000)
        /usr/lib/go-1.7/src/runtime/asm_amd64.s:298 +0x79
runtime.mstart()
        /usr/lib/go-1.7/src/runtime/proc.go:1079

goroutine 1 [running]:
runtime.systemstack_switch()
        /usr/lib/go-1.7/src/runtime/asm_amd64.s:252 fp=0xc42003dd18 
sp=0xc42003dd10
runtime.writebarrierptr(0x7fbca8000960, 0x1)
        /usr/lib/go-1.7/src/runtime/mbarrier.go:152 +0x7b fp=0xc42003dd50 
sp=0xc42003dd18
def.(*Instance).DrawLoop(0xc420062f70)
        /home/florian/go/src/def/instance.go:353 +0xbea fp=0xc42003deb0 
sp=0xc42003dd50
main.main()
        /home/florian/go/src/program/main.go:35 +0x27a fp=0xc42003df58 
sp=0xc42003deb0
runtime.main()
        /usr/lib/go-1.7/src/runtime/proc.go:183 +0x1f4 fp=0xc42003dfb0 
sp=0xc42003df58
runtime.goexit()
        /usr/lib/go-1.7/src/runtime/asm_amd64.s:2086 +0x1 fp=0xc42003dfb8 
sp=0xc42003dfb0

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
        /usr/lib/go-1.7/src/runtime/asm_amd64.s:2086 +0x1

goroutine 5 [syscall]:
runtime.CPUProfile(0x0, 0x0, 0x0)
        /usr/lib/go-1.7/src/runtime/cpuprof.go:447 +0x2d
runtime/pprof.profileWriter(0x55fdd4b52a80, 0xc42002c078)
        /usr/lib/go-1.7/src/runtime/pprof/pprof.go:676 +0x26
created by runtime/pprof.StartCPUProfile
        /usr/lib/go-1.7/src/runtime/pprof/pprof.go:670 +0x122

-- 
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