pebbe / zmq4

A Go interface to ZeroMQ version 4
BSD 2-Clause "Simplified" License
1.17k stars 163 forks source link

malloc(): memory corruption (fast) #95

Closed barnettZQG closed 7 years ago

barnettZQG commented 7 years ago
malloc(): memory corruption (fast): 0x00007f2e04005d88 ***
SIGABRT: abort
PC=0x7f2ebaad3f79 m=44
signal arrived during cgo execution

goroutine 1928 [syscall, locked to thread]:
runtime.cgocall(0x1620af0, 0xc8218d1b08, 0xc800000000)
    /usr/local/go/src/runtime/cgocall.go:123 +0x11b fp=0xc8218d1a98 sp=0xc8218d1a68
github.com/pebbe/zmq4._C2func_zmq_send(0x7f2db40225e0, 0xc821d643c0, 0x20, 0x2, 0x0, 0x0, 0x0)
    ??:0 +0x55 fp=0xc8218d1b08 sp=0xc8218d1a98
github.com/pebbe/zmq4.(*Socket).SendBytes(0xc82086fb90, 0xc821d643c0, 0x20, 0x20, 0x2, 0x20, 0x0, 0x0)
    /usr/src/docker/vendor/src/github.com/pebbe/zmq4/zmq4.go:870 +0x296 fp=0xc8218d1bf8 sp=0xc8218d1b08
github.com/pebbe/zmq4.(*Socket).Send(0xc82086fb90, 0xc8222e857a, 0x20, 0x2, 0x10000c800000001, 0x0, 0x0)
    /usr/src/docker/vendor/src/github.com/pebbe/zmq4/zmq4.go:854 +0x8f fp=0xc8218d1c58 sp=0xc8218d1bf8

I need help.I use ZMQ sends a large number of log messages, ubuntu system collapses under the above mistakes sometimes cause process.

barnettZQG commented 7 years ago

This issue because ZeroMQ sockets are not threads-safe. When multithreaded operations must be locked.