Attached is a minimal test case for a failure that hit my appilcation. In the real app, various server threads have XREP sockets opened, and my front-end web threads open REQ sockets to send request messages that help them build their HTTP response content. After enough socket opens and closings — actually, only one or two (!) in the real app, presumably because so much more is going on in a real app — the application dies with, variously, a segmentation fault (usually in the zmq “recv” function), a hang, or an interesting message (and accompanying libc stack trace!) about “malloc(): memory corruption.”
As you can see, all that seems necessary to kill ØMQ is to open and close enough incoming sockets toward the XREP, and ØMQ will die and take the application with it.
Since I cannot find any record of anyone else ever hitting this problem — whereas it happened for me the very first time that I ever put ØMQ under the demand of two web server threads at once — I would also love to hear whether I am completely wrong to be creating and closing sockets using these calls. It would be great to learn how everyone else is using ØMQ without crashes!