5.2.2. Serialization and Deserialization
5.2.2.1. [Critical] Unexpected error messages when disposing of an instance while using batching and setting serialize_key_with_dispose to TRUE
Consider the following DataWriter QoS:
<datawriter_qos>
<batch>
<enable>true</enable>
</batch>
<protocol>
<serialize_key_with_dispose>true</serialize_key_with_dispose>
</protocol>
</datawriter_qos>
The data type is keyed, and the serialized key is not aligned to a 4-byte boundary.
Imagine that DataWriter1 registers an instance, and then DataWriter2 uses the resulting InstanceHandle to write and dispose that instance. DataWriter2 successfully sends one batch with a data sample of a given instance and then attempts to send another batch whose first sample is a dispose message for that same instance.
When using release libraries, DataWriter2 would have successfully sent the second batch, but the DataReader that was reading the batch from DataWriter2 would have experienced this error:
ERROR MIGInterpreter_parse:submessage not aligned to 4
When using debug libraries, DataWriter2 would have failed to send the batch and generated this error:
mig.2.0/srcC/generator/Generator.c:1216:RTI0x200003a:!precondition: "!(sample != ((void *)0) && (((sample)->serializedData[encapsulationIndex].serializedData.pointer == ((void *)0) || ((sample)->serializedData[encapsulationIndex].serializedData.length & 0x3) == 0)) && (((sample)->protocolParameters.pointer == ((void *)0) || ((sample)->protocolParameters.length & 0x3) == 0)))
This problem only affected 7.3.0 and above. DataWriter2 now successfully sends the batch, and the DataReader successfully receives the batch when using either release or debug libraries.
[RTI Issue ID CORE-15528]