In PerDestinationBundler, if we have {use_single_sender_thread=false}}, we have 1 thread per destination sending messages. In this case, the bundler disables TCP.use_lock_to_send.
However, this can lead to corrupted data at the receiver:
packet from 192.168.1.110:7802 has different version (0.0.0) than ours (5.5.0); packet is discarded
The cause is this:
- When we send a multicast, the SendBuffer thread responsible for destination NULL sends the message to all members
- When - at the same time - we send a unicast message to one of the members, the multicast and the unicast are concurrent, and might therefore lead to stream corruption at the receiver
Solution
- Set TCP_use_lock_to_send to true when use_single_sender_thread is false
- Alternatively:
- Handle a multicast M to {A,B,C,D} by adding M to the 4 queues. A unicast and a multicast message will therefore not be sent concurrently
- Note: only do this for TCP / TCP_NIO2; UDP benefits from sending multicast messages as an IP multicast (single packet)