[zeromq-dev] Deadlock between REQ/REP sockets?

Dana Leonard dleonar at gmail.com
Thu May 27 20:51:09 CEST 2010

I am prohibited from posting code, so I'll do my best to describe my

I've got a IPC client/server setup and I am having problems getting the
server to respond consistantly. The server has a REP socket open that it
uses to listen for client requests. When it receives a request, it creates a
new P2P socket for that client, spawns a listen thread for that socket, and
loops back around. The client creates a matching P2P socket and is able to
send and receive messages on that socket.

The problem seems to show itself when I try to create 2nd client. I timeout
(via signal() and alarm()) on the client's receive call while waiting for
the server to respond. Thanks to plenty of print statements, I know that the
server is blocking on receive on the REP socket and the client has already
sent its message on the REQ socket. After the timeout, the client process
quits, and THEN the server seems to become responsive again. Its prints out
that it received a message on the REP socket and sends a reply (to a client
that no longer exists).

Any ideas on why the server seems to respond only after the client process
quits? I would suspect that there is a deadlock or something happening but
since I have no code explicitly locking or unlocking mutexes I don't know
where to look.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100527/3aec4fe4/attachment.htm>

More information about the zeromq-dev mailing list