[zeromq-dev] PUSH PULL crash in send
Luca Boccassi
luca.boccassi at gmail.com
Sat Jul 22 14:20:11 CEST 2017
On Fri, 2017-07-21 at 15:44 +0000, david.myers at avalesta.com wrote:
> Hello,
>
> I have a windows 64-bit project where two processes (windows exes)
> connect via ZeroMQ.
>
> Process 1, the plugin process, collects video frames and decodes
> them.
> This process sends the decoded frames to process 2, the GUI, for
> display.
>
> I originally used REQ REP sockets, with the plugin as the REQ sending
> to
> the GUI, the REP, which then sent an Acknowledge back after each data
> frame. However, this model meant that the sending (plugin) process
> was
> waiting up to 20ms for an Ack from the GUI before it could send the
> next
> frame and so, because the data only went one way, we changed the
> model
> to PUSH PULL. This is when our troubles began.
>
> After sending a random number of frames, the sending process (the
> PUSH
> socket) is crashing in tcp.cpp, here:-
>
> int zmq::tcp_write (fd_t s_, const void *data_, size_t size_)
> {
> #ifdef ZMQ_HAVE_WINDOWS
>
> int nbytes = send (s_, (char*) data_, (int) size_, 0);
>
> .
> .
> }
>
> nbytes is returning -1 and the error code is 10014 WSAEFAULT bad
> address. I seem to be overflowing the Send data buffers or perhaps
> sending too fast for the receiver process to receive the data on the
> PULL socket.
>
> The only way I can seem to avoid this error is put a Sleep(20) ie
> sleep
> for 20ms, after each send. With this sleep I'm back where I started
> with
> a 20ms delay between image frame sends.
>
> Is this really how PUSH PULL sockets work?
>
> How can I send data as fast as possible? If I have to skip frames at
> the
> receive end, I don't really care too much, but I need a robust
> mechanism
> and I thought ZMQ was made for this type of data transfer.
>
> Many thanks for any help or ideas.
> David
Never seen those aborts in Linux so it must be a Windows problem, sorry
can't help with that myself, maybe someone else can. A "bad address"
error doesn't sound like related to overflowing, which should return
something like EAGAIN, but then again I have no idea how the Windows
networking stack works.
Regarding the correct pattern to use, I would encourage you to have a
look at the zguide: http://zguide.zeromq.org/
In short, PUSH-PULL is reliable and will not drop if the receiver is
slow, but it will block. That is by design.
If you want to maximise performance at the expense of dropping packets,
the best pattern is PUB-SUB.
--
Kind regards,
Luca Boccassi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20170722/8195726d/attachment.sig>
More information about the zeromq-dev
mailing list