golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.83k stars 17.65k forks source link

fatal error: unexpected signal during runtime execution on Mac OS X / Darwin #12746

Closed harshavardhana closed 9 years ago

harshavardhana commented 9 years ago

Running cgo compiled binary caused runtime error, do not know what could be the problem?

[signal 0xa code=0x2 addr=0xcb1e0f5520 pc=0x4004794]

runtime stack:
runtime.throw(0x459f9e0, 0x2a)
        /usr/local/Cellar/go/1.5.1/libexec/src/runtime/panic.go:527 +0x90
runtime.sigpanic()
        /usr/local/Cellar/go/1.5.1/libexec/src/runtime/sigpanic_unix.go:12 +0x5a

goroutine 67 [syscall, locked to thread]:
runtime.cgocall(0x4002d30, 0xc8202b1700, 0xc800000000)
        /usr/local/Cellar/go/1.5.1/libexec/src/runtime/cgocall.go:120 +0x11b fp=0xc8202b16b8 sp=0xc8202b1688
github.com/minio/minio/pkg/erasure._Cfunc_minio_get_source_target(0x200000000, 0x2, 0x0, 0x7fff5fbff670, 0xc8200fa000, 0xc82002c000, 0xc82002c020, 0x3e00000000)
        github.com/minio/minio/pkg/erasure/_obj/_cgo_gotypes.go:64 +0x3c fp=0xc8202b1700 sp=0xc8202b16b8
github.com/minio/minio/pkg/erasure.(*Erasure).Decode(0xc820193e30, 0xc82001a180, 0x4, 0x4, 0x130bf4, 0x0, 0x0, 0x0, 0x0, 0x0)
        /Users/harsha/mygo/src/github.com/minio/minio/pkg/erasure/erasure_decode.go:103 +0x7d9 fp=0xc8202b18d0 sp=0xc8202b1700
github.com/minio/minio/pkg/donut.encoder.Decode(0xc820193e30, 0xc820010202, 0xc82001a180, 0x4, 0x4, 0x130bf4, 0x0, 0x0, 0x0, 0x3)
        /Users/harsha/mygo/src/github.com/minio/minio/pkg/donut/encoder.go:96 +0x76 fp=0xc8202b1950 sp=0xc8202b18d0
github.com/minio/minio/pkg/donut.bucket.decodeEncodedData(0xc82019342c, 0xa, 0x4510f78, 0x7, 0xecd96a0d1, 0x1018eb6d, 0x47487a0, 0xc820011a80, 0xe, 0xc820015f80, ...)
        /Users/harsha/mygo/src/github.com/minio/minio/pkg/donut/bucket.go:582 +0x41b fp=0xc8202b1ab0 sp=0xc8202b1950
github.com/minio/minio/pkg/donut.bucket.readObjectData(0xc82019342c, 0xa, 0x4510f78, 0x7, 0xecd96a0d1, 0x1018eb6d, 0x47487a0, 0xc820011a80, 0xe, 0xc820015f80, ...)
        /Users/harsha/mygo/src/github.com/minio/minio/pkg/donut/bucket.go:512 +0xc2f fp=0xc8202b1e90 sp=0xc8202b1ab0
runtime.goexit()
        /usr/local/Cellar/go/1.5.1/libexec/src/runtime/asm_amd64.s:1696 +0x1 fp=0xc8202b1e98 sp=0xc8202b1e90
created by github.com/minio/minio/pkg/donut.bucket.ReadObject
        /Users/harsha/mygo/src/github.com/minio/minio/pkg/donut/bucket.go:233 +0x5fe

goroutine 1 [select]:
davecheney commented 9 years ago

It looks like your c code dereferenced a nil pointer and got SIGSEGV in return.

On Fri, 25 Sep 2015 12:24 Harshavardhana notifications@github.com wrote:

Running cgo compiled binary caused runtime error, do not know what could be the problem?

[signal 0xa code=0x2 addr=0xcb1e0f5520 pc=0x4004794]

runtime stack: runtime.throw(0x459f9e0, 0x2a) /usr/local/Cellar/go/1.5.1/libexec/src/runtime/panic.go:527 +0x90 runtime.sigpanic() /usr/local/Cellar/go/1.5.1/libexec/src/runtime/sigpanic_unix.go:12 +0x5a

goroutine 67 [syscall, locked to thread]: runtime.cgocall(0x4002d30, 0xc8202b1700, 0xc800000000) /usr/local/Cellar/go/1.5.1/libexec/src/runtime/cgocall.go:120 +0x11b fp=0xc8202b16b8 sp=0xc8202b1688github.com/minio/minio/pkg/erasure._Cfunc_minio_get_source_target(0x200000000, 0x2, 0x0, 0x7fff5fbff670, 0xc8200fa000, 0xc82002c000, 0xc82002c020, 0x3e00000000) github.com/minio/minio/pkg/erasure/_obj/_cgo_gotypes.go:64 +0x3c fp=0xc8202b1700 sp=0xc8202b16b8github.com/minio/minio/pkg/erasure.(*Erasure).Decode(0xc820193e30, 0xc82001a180, 0x4, 0x4, 0x130bf4, 0x0, 0x0, 0x0, 0x0, 0x0) /Users/harsha/mygo/src/github.com/minio/minio/pkg/erasure/erasure_decode.go:103 +0x7d9 fp=0xc8202b18d0 sp=0xc8202b1700github.com/minio/minio/pkg/donut.encoder.Decode(0xc820193e30, 0xc820010202, 0xc82001a180, 0x4, 0x4, 0x130bf4, 0x0, 0x0, 0x0, 0x3) /Users/harsha/mygo/src/github.com/minio/minio/pkg/donut/encoder.go:96 +0x76 fp=0xc8202b1950 sp=0xc8202b18d0github.com/minio/minio/pkg/donut.bucket.decodeEncodedData(0xc82019342c, 0xa, 0x4510f78, 0x7, 0xecd96a0d1, 0x1018eb6d, 0x47487a0, 0xc820011a80, 0xe, 0xc820015f80, ...) /Users/harsha/mygo/src/github.com/minio/minio/pkg/donut/bucket.go:582 +0x41b fp=0xc8202b1ab0 sp=0xc8202b1950github.com/minio/minio/pkg/donut.bucket.readObjectData(0xc82019342c, 0xa, 0x4510f78, 0x7, 0xecd96a0d1, 0x1018eb6d, 0x47487a0, 0xc820011a80, 0xe, 0xc820015f80, ...) /Users/harsha/mygo/src/github.com/minio/minio/pkg/donut/bucket.go:512 +0xc2f fp=0xc8202b1e90 sp=0xc8202b1ab0 runtime.goexit() /usr/local/Cellar/go/1.5.1/libexec/src/runtime/asm_amd64.s:1696 +0x1 fp=0xc8202b1e98 sp=0xc8202b1e90 created by github.com/minio/minio/pkg/donut.bucket.ReadObject /Users/harsha/mygo/src/github.com/minio/minio/pkg/donut/bucket.go:233 +0x5fe

goroutine 1 [select]:

— Reply to this email directly or view it on GitHub https://github.com/golang/go/issues/12746.

harshavardhana commented 9 years ago

It looks like your c code dereferenced a nil pointer and got SIGSEGV in

That would have been interesting, but moving from -O0 to -O2 in CFLAGS made it work properly. I wonder what is going on.

Will dig further..

harshavardhana commented 9 years ago

Not a golang bug, closing this.. Thanks @davecheney