lspgn commented on issue #5695: Go: Segfault on messageId serialize after getting it from producer URL: https://github.com/apache/pulsar/issues/5695#issuecomment-561032305 @wolfstudy sorry to re-open (was on vacations), I ran tests with the example file: I'm getting the following: It rarely manages to display a message Id (maybe a race condition?), most of the time, it just panic at the first one. ``` The message Id value is: [(4294967295,140734859843417,57,0)] The message Id value is: [(75552472,0,2433,36)] fatal error: unexpected signal during runtime execution [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x470fafa] runtime stack: runtime.throw(0x434b363, 0x2a) /usr/local/Cellar/go/1.13.3/libexec/src/runtime/panic.go:774 +0x72 runtime.sigpanic() /usr/local/Cellar/go/1.13.3/libexec/src/runtime/signal_unix.go:378 +0x47c goroutine 1 [syscall]: runtime.cgocall(0x42932a0, 0xc000109800, 0x40) /usr/local/Cellar/go/1.13.3/libexec/src/runtime/cgocall.go:128 +0x5b fp=0xc0001097d0 sp=0xc000109798 pc=0x400519b github.com/apache/pulsar/pulsar-client-go/pulsar._Cfunc_pulsar_message_id_str(0x6e003b0, 0x0) _cgo_gotypes.go:1279 +0x4a fp=0xc000109800 sp=0xc0001097d0 pc=0x4279c3a github.com/apache/pulsar/pulsar-client-go/pulsar.(*messageID).String.func1(0xc0000a8080, 0x4037e80) /Users/me/go/pkg/mod/github.com/apache/pulsar/pulsar-client-go@v0.0.0-20191203033040-9137065ffcac/pulsar/c_message.go:199 +0x5e fp=0xc000109840 sp=0xc000109800 pc=0x428906e github.com/apache/pulsar/pulsar-client-go/pulsar.(*messageID).String(0xc0000a8080, 0x0, 0x0) /Users/me/go/pkg/mod/github.com/apache/pulsar/pulsar-client-go@v0.0.0-20191203033040-9137065ffcac/pulsar/c_message.go:199 +0x37 fp=0xc0001098a8 sp=0xc000109840 pc=0x4280ba7 fmt.(*pp).handleMethods(0xc000120000, 0x76, 0x1) /usr/local/Cellar/go/1.13.3/libexec/src/fmt/print.go:630 +0x302 fp=0xc000109ab8 sp=0xc0001098a8 pc=0x40bc262 fmt.(*pp).printArg(0xc000120000, 0x42e3bc0, 0xc0000a8080, 0xc000000076) /usr/local/Cellar/go/1.13.3/libexec/src/fmt/print.go:713 +0x206 fp=0xc000109b50 sp=0xc000109ab8 pc=0x40bc826 fmt.(*pp).doPrintf(0xc000120000, 0x4346be0, 0x1f, 0xc000109e20, 0x1, 0x1) /usr/local/Cellar/go/1.13.3/libexec/src/fmt/print.go:1030 +0x15b fp=0xc000109c38 sp=0xc000109b50 pc=0x40c01eb fmt.Fprintf(0x43a5ce0, 0xc0000a8008, 0x4346be0, 0x1f, 0xc000109e20, 0x1, 0x1, 0x0, 0x0, 0x0) /usr/local/Cellar/go/1.13.3/libexec/src/fmt/print.go:204 +0x72 fp=0xc000109ca0 sp=0xc000109c38 pc=0x40b9092 fmt.Printf(...) /usr/local/Cellar/go/1.13.3/libexec/src/fmt/print.go:213 main.main() /Users/me/repos/pulsar-test/producer.go:61 +0x2ee fp=0xc000109f60 sp=0xc000109ca0 pc=0x4291d1e runtime.main() /usr/local/Cellar/go/1.13.3/libexec/src/runtime/proc.go:203 +0x21e fp=0xc000109fe0 sp=0xc000109f60 pc=0x4030cae runtime.goexit() /usr/local/Cellar/go/1.13.3/libexec/src/runtime/asm_amd64.s:1357 +0x1 fp=0xc000109fe8 sp=0xc000109fe0 pc=0x405b561 exit status 2 ``` ``` The message Id value is: [(75552472,0,2433,36)] fatal error: unexpected signal during runtime execution [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x470fafa] runtime stack: runtime.throw(0x434b363, 0x2a) /usr/local/Cellar/go/1.13.3/libexec/src/runtime/panic.go:774 +0x72 runtime.sigpanic() /usr/local/Cellar/go/1.13.3/libexec/src/runtime/signal_unix.go:378 +0x47c goroutine 1 [syscall]: runtime.cgocall(0x42932a0, 0xc000109800, 0xa0) /usr/local/Cellar/go/1.13.3/libexec/src/runtime/cgocall.go:128 +0x5b fp=0xc0001097d0 sp=0xc000109798 pc=0x400519b github.com/apache/pulsar/pulsar-client-go/pulsar._Cfunc_pulsar_message_id_str(0x7001240, 0x0) _cgo_gotypes.go:1279 +0x4a fp=0xc000109800 sp=0xc0001097d0 pc=0x4279c3a github.com/apache/pulsar/pulsar-client-go/pulsar.(*messageID).String.func1(0xc0000a8078, 0x4037e80) /Users/me/go/pkg/mod/github.com/apache/pulsar/pulsar-client-go@v0.0.0-20191203033040-9137065ffcac/pulsar/c_message.go:199 +0x5e fp=0xc000109840 sp=0xc000109800 pc=0x428906e github.com/apache/pulsar/pulsar-client-go/pulsar.(*messageID).String(0xc0000a8078, 0x0, 0x0) /Users/me/go/pkg/mod/github.com/apache/pulsar/pulsar-client-go@v0.0.0-20191203033040-9137065ffcac/pulsar/c_message.go:199 +0x37 fp=0xc0001098a8 sp=0xc000109840 pc=0x4280ba7 fmt.(*pp).handleMethods(0xc00011e000, 0x76, 0x1) /usr/local/Cellar/go/1.13.3/libexec/src/fmt/print.go:630 +0x302 fp=0xc000109ab8 sp=0xc0001098a8 pc=0x40bc262 fmt.(*pp).printArg(0xc00011e000, 0x42e3bc0, 0xc0000a8078, 0x76) /usr/local/Cellar/go/1.13.3/libexec/src/fmt/print.go:713 +0x206 fp=0xc000109b50 sp=0xc000109ab8 pc=0x40bc826 fmt.(*pp).doPrintf(0xc00011e000, 0x4346be0, 0x1f, 0xc000109e20, 0x1, 0x1) /usr/local/Cellar/go/1.13.3/libexec/src/fmt/print.go:1030 +0x15b fp=0xc000109c38 sp=0xc000109b50 pc=0x40c01eb fmt.Fprintf(0x43a5ce0, 0xc0000a8008, 0x4346be0, 0x1f, 0xc000109e20, 0x1, 0x1, 0x0, 0x0, 0x0) /usr/local/Cellar/go/1.13.3/libexec/src/fmt/print.go:204 +0x72 fp=0xc000109ca0 sp=0xc000109c38 pc=0x40b9092 fmt.Printf(...) /usr/local/Cellar/go/1.13.3/libexec/src/fmt/print.go:213 main.main() /Users/me/repos/pulsar-test/producer.go:63 +0x2ee fp=0xc000109f60 sp=0xc000109ca0 pc=0x4291d1e runtime.main() /usr/local/Cellar/go/1.13.3/libexec/src/runtime/proc.go:203 +0x21e fp=0xc000109fe0 sp=0xc000109f60 pc=0x4030cae runtime.goexit() /usr/local/Cellar/go/1.13.3/libexec/src/runtime/asm_amd64.s:1357 +0x1 fp=0xc000109fe8 sp=0xc000109fe0 pc=0x405b561 exit status 2 ``` I'm trying to debug it. Issue seems to be there: https://github.com/apache/pulsar/blob/be6a102511560349701dbe6b83fabf831dc81340/pulsar-client-go/pulsar/c_message.go#L199 Which in the library is the following: https://github.com/apache/pulsar/blame/master/pulsar-client-cpp/lib/c/c_MessageId.cc#L62-L65 Not very familiar with the C build but will try to have verbose debug. (managed to reproduce the [make from Homebrew](https://github.com/Homebrew/homebrew-core/blob/master/Formula/libpulsar.rb)) ``` cmake . \ -DBUILD_TESTS=OFF \ -DBUILD_PYTHON_WRAPPER=OFF \ -DBoost_INCLUDE_DIRS=/usr/local/Cellar/boost/1.71.0/include/ \ -DProtobuf_INCLUDE_DIR=/usr/local/Cellar/protobuf/3.10.0/include \ -DProtobuf_LIBRARIES=/usr/local/Cellar/protobuf/3.10.0/lib/libprotobuf.dylib ```
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services