[zeromq-dev] Loosing first message with PGM

Emmanuel TAUREL taurel at esrf.fr
Thu Sep 29 10:26:56 CEST 2011

Hello all,

I am using zmq 3.0.x. on Linux boxes (Ubuntu).
I am using pub/sub pattern.
In my application, on the publisher side, I have a publisher socket 
using TCP transport and another publisher socket using PGM transport.
I am able to manually trigger the PGM publisher to publish 1 multipart 
There are messages published at regular interval in the TCP publisher 
(every 9 seconds).

I start the subscriber process which is doing nothing else then waiting 
for ZMQ messages.
To do so, it has a thread listening for ZMQ sockets using the zmq::poll 
call. IT has 2 sockets (one sub for TCP and another one for PGM)
The subscriber process receives without any problem the TCP messages.
Nevertheless, the first message sent by the PGM publisher is lost 
because the zmq::poll() call does not return for this first PGM message!

I had a look at network packets using wireshark on the subscriber side.
I see the PGM SPM packet sent every 30 seconds.
Then I see the ODATA packet sent by the first PGM message from the 
publisher host.
This packet is followed by several SPM packets but it does not make my 
thread to return from the zmq::poll() call!
I do not notice something different on the network packets when I 
compare the first PGM message exchange with the following one (which 
makes my
code to return from the zmq::poll)

The problem is the same if I use epgm instead of pgm.
The same code works fine if all messages are transported using TCP.

Do you have any idea how I could solve this problem?
Is it due to a bad usage of zmq::poll() call?

Thank's for your answer

Emmanuel Taurel

More information about the zeromq-dev mailing list