Hi, I'm successfully using pub-sub (CZMQ 3.0.0-rc1 and ZMQ 4.0.5), but I'm observing the following problem.
My publisher can sometimes be a short-lived program that does something, publishes the data, then closes the socket and exits the program. If the data is sufficiently large*, I can see the published data get truncated on the wire with tcpdump (the data is segmented into multiple wire packets and I see the first few but not the end). My hypothesis is that closing the socket and exiting the program kills the ZMQ I/O thread halfway through the send. The following observations support the hypothesis, 1) if the program publishes a short message after the long one, both are received at the subscriber and 2) if I make the program sleep for a bit before closing the socket and exiting, the data is received at the subscriber. Unfortunately, neither of these is a very reliable solution. If I understand the documentation correctly, ZMQ_LINGER will not help because the program itself exits. Is there a way to query the I/O thread to get the number of pending messages? I haven't found such a method in the documentation, but I have just missed it. If so, I could just poll that and only exit when there are no pending messages. Or is the only reliable method to have the subscriber send an ack and not let the publisher exit until it receives the ack? Thanks, Scott * 100KB will consistently reproduce the issue. _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
