According to the docs, by default if a socket is closed, its send queue will still be sent. However, the behavior I'm seeing casts some doubt on this.
What I'm designing is a simple test-case, so its real-world applicability is questionable, but I'd like to understand what is going on. I have two threads. One thread has a DEALER and the other a ROUTER. The DEALER connects to the router over TCP. The DEALER spews 10,000 messages at the ROUTER, then closes. The ROUTER reads 10,000 messages, and then closes. What's actually happening is fewer than 10,000 messages are arriving (around 9,500, on average, but it varies), so the ROUTER's thread is hanging. I'm trying to understand why. I can tell from my logs that the DEALER finishes sending some time before the last successful receive by the ROUTER. My speculation is that I'm closing the DEALER too soon, and its queued messages aren't all being sent. One practical solution would be for the ROUTER to send back a "THANKS" message to the DEALER once it has everything, and not allow the socket to close until then. I would like to understand the subtleties of the implementation, though.
_______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
