[zeromq-dev] problem running two 0mq applications on one host side-by-side
Chris Dinn
cdinn at mdialog.com
Mon Apr 16 16:07:42 CEST 2012
> 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.
Thanks for the tip Pieter, looks like you were exactly right. It appears that the Scala binding is using JNA to allocate a buffer for zmq_msg_init_data, but doing nothing to ensure that the buffer is still valid at the time the message is actually sent.
https://github.com/kro/zeromq-scala-binding/blob/master/src/main/java/org/zeromq/ZMQ.java#L434
I'm working on a fix now. Thanks again.
--Chris
More information about the zeromq-dev
mailing list