[zeromq-dev] problem running two 0mq applications on one host side-by-side

Pieter Hintjens ph at imatix.com
Sat Apr 14 10:01:42 CEST 2012


On Fri, Apr 13, 2012 at 9:24 PM, Chris Dinn <cdinn at mdialog.com> wrote:

> In this case, messages are being sent by the ZMQ Scala binding. The message
> send code for that binding uses JNA, you can fin the relevant method here:
>
> https://github.com/kro/zeromq-scala-binding/blob/master/src/main/java/org/zeromq/ZMQ.java#L342
>
> Pieter, are you suggesting that the message is being GC'd prior to the being
> sent? Not sure how else this memory could be freed too soon.

The main cause (actually the only one I know) for corrupted messages
is when you send from a buffer (using zmq_msg_init_data) and then free
or reuse the buffer. Since data isn't copied, if the original buffer
isn't valid when the message actually gets sent (at some later point
by the I/O thread), it'll send garbage.

-Pieter



More information about the zeromq-dev mailing list