Skip to content

zmq sockets crash with goroutines #21

Description

@Irooniam

I'm using websockets with zmq running on top of it.

go version go1.3.3 linux/amd64
libzmq Version: 3.2.4

The error in question is:

Assertion failed: ok (mailbox.cpp:84)
SIGABRT: abort
PC=0x3721c35877
signal arrived during cgo execution

I looked up the mailbox.cpp error and the general consensus is that it has to do with different threads trying to use the same zmq socket.

I have a coroutine running and it communicates with the other coroutines via channels, thus other coroutines do not directly access the zmq socket.

The trace is as follows:

goroutine 22 [syscall]:
runtime.cgocall(0x402790, 0x7fa0ba589b10)
    /usr/local/go/src/pkg/runtime/cgocall.c:143 +0xe5 fp=0x7fa0ba589ae8 sp=0x7fa0ba589aa0
github.com/pebbe/zmq3._C2func_zmq_send(0x12c4c80, 0xc20a78a380, 0x7d, 0x7fa000000001, 0x4784e0, 0xc20808600d, 0xc20a78a380)
    github.com/pebbe/zmq3/_obj/_cgo_defun.c:365 +0x36 fp=0x7fa0ba589b10 sp=0x7fa0ba589ae8
github.com/pebbe/zmq3.(*Socket).SendBytes(0xc208025410, 0xc20a78a380, 0x7d, 0x80, 0x1, 0x7fa0ba589c08, 0x0, 0x0)
    /data/Projects/messaging/src/github.com/pebbe/zmq3/zmq3.go:549 +0xf0 fp=0x7fa0ba589ba8 sp=0x7fa0ba589b10
github.com/pebbe/zmq3.(*Socket).Send(0xc208025410, 0xc20a78a280, 0x7d, 0x1, 0x7d, 0x0, 0x0)
    /data/Projects/messaging/src/github.com/pebbe/zmq3/zmq3.go:536 +0x76 fp=0x7fa0ba589bf0 sp=0x7fa0ba589ba8
github.com/pebbe/zmq3.(*Socket).sendMessage(0xc208025410, 0x1, 0x7fa0ba589f50, 0x1, 0x1, 0x0, 0x0, 0x0)
    /data/Projects/messaging/src/github.com/pebbe/zmq3/utils.go:59 +0x5f8 fp=0x7fa0ba589e98 sp=0x7fa0ba589bf0
github.com/pebbe/zmq3.(*Socket).SendMessageDontwait(0xc208025410, 0x7fa0ba589f50, 0x1, 0x1, 0xa5, 0x0, 0x0)
    /data/Projects/messaging/src/github.com/pebbe/zmq3/utils.go:25 +0x65 fp=0x7fa0ba589ee0 sp=0x7fa0ba589e98
plug.(*Dealer).Recv(0xc2080282b0)
    /data/Projects/messaging/src/plug/dealer.go:72 +0x2a7 fp=0x7fa0ba589fa0 sp=0x7fa0ba589ee0
runtime.goexit()
    /usr/local/go/src/pkg/runtime/proc.c:1445 fp=0x7fa0ba589fa8 sp=0x7fa0ba589fa0
created by main.main
    /data/Projects/messaging/src/wsServer.go:25 +0x25f

Any help would be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions