Thanks for taking a quick look.
The first goroutine looks like this. It still gives me no clue. It is a single thread c program. However, two go routines might be calling it at the same time.
goroutine 560 [syscall]:
runtime.cgocall(0x403820, 0x7fa2c01db918)
/usr/local/go/src/pkg/runtime/cgocall.c:143 +0xe5 fp=0x7fa2c01db900 sp=0x7fa2c01db8b8
main._Cfunc_encoder(0x200000005, 0x64000000005, 0xcf22551000, 0xcf12d981c0, 0xca9b45f8fc, 0xcba710a8fc, 0x18)
mycode/_obj/_cgo_defun.c:66 +0x36 fp=0x7fa2c01db918 sp=0x7fa2c01db900
main.encoder_core(0x7fa2c01dbe18, 0x1, 0x1, 0xca9b45f8fc, 0x22551000, 0x13b4df904, 0xcba710a8fc, 0xdbba000, 0x2f834904, 0xcd950dc020, ...)
/home/eric.z/git/src/mycode/encoder.go:391 +0x2bc fp=0x7fa2c01dbaf0 sp=0x7fa2c01db918
main.encoder(0x6, 0xcd950ca5a0, 0xcd950dc020, 0x1, 0x1, 0x5, 0xcdc4cdc1d8, 0xc2080542a0, 0xcd94e81380, 0xcdc4cde300)
/home/eric.z/git/src/mycode/encoder.go:460 +0xa7f fp=0x7fa2c01dbf58 sp=0x7fa2c01dbaf0
runtime.goexit()
/usr/local/go/src/pkg/runtime/proc.c:1445 fp=0x7fa2c01dbf60 sp=0x7fa2c01dbf58
created by main.destination
/home/eric.z/git/src/mycode/main.go:1493 +0x1243