Error in Serialization and Deserialization

3 posts / 0 new
Last post
Offline
Last seen: 1 year 10 months ago
Joined: 08/13/2014
Posts: 55
Error in Serialization and Deserialization

Hi,

I'm using RTI version 5.2.0 (Modern C++ API) and I sometimes get the following error in my output terminal. What is this error and what should I do? For your information, my program is a small version of recording service and I do serialization and deserialization of dynamic data and synamic type in my program. I have also brought my codes for serialization and deserialization of dynamic type below. For dynamic data serialization and deserialization, I use "to_cdr_buffer" and "from_cdr_buffer" functions respectively. 

DDS_DynamicDataTypePlugin_process_primitive_cdr_value:invalid enumerator value
DDS_DynamicDataTypePlugin_parametrized_cdr_to_cdr:error copying CDR value
DDS_DynamicDataTypePlugin_parametrized_cdr_to_cdr:error converting from extended CDR to CDR
DDS_DynamicDataTypePlugin_deserialize:error converting from extended CDR to CDR
PRESCstReaderCollator_storeSampleData:!deserialize
DDS_TypeCode *ReplayManager::deserializedTypeCode(std::vector<char>& serializedTypeCode, int serializedTypeCodeLen)
{
 buffer.resize(serializedTypeCodeLen);
 if (!RTICdrTypeCode_initialize_stream((struct RTICdrTypeCode *)&buffer[0], serializedTypeCodeLen) ) {
 printf("TypeCodeSerialization::deserialize_TypeCode: type code buffer size "
 " is not large enough\n");
 return NULL;
 }
 RTICdrTypeCode_copy_stream(
 (struct RTICdrTypeCode *)&buffer[0],
 (struct RTICdrTypeCode *)serializedTypeCode.data());
 RTICdrTypeCode *cdrTypeCode = (struct RTICdrTypeCode *)&buffer[0];
 DDS_TypeCode *typeCode = (DDS_TypeCode *)cdrTypeCode;
 return typeCode;
}
bool DDSManager::serializeTypeCode(char *buffer, unsigned int bufferLen, const DDS_TypeCode *typeCode)
{
 RTICdrStream stream;
 RTICdrStream_init(&stream);
 RTICdrStream_set(&stream, buffer, bufferLen);
 // We do not want any limits. Assigning (-1) to an unsigned int
 // results in the maximum unsigned int
 unsigned int serializedTypecodeMaxSize = -1;
 return RTICdrTypeCode_serialize(
 NULL,
 &typeCode->_data, &stream,
 RTI_TRUE, RTI_CDR_ENCAPSULATION_ID_CDR_NATIVE,
 RTI_TRUE, /* Serialize the data on the 2nd parameter (typeCode) */
 &serializedTypecodeMaxSize /* Must be a pointer to the length of the stream */);
}

Bonjefir

Offline
Last seen: 11 months 3 weeks ago
Joined: 11/28/2016
Posts: 7

Hi Bonjefir,

This error happens when the DataReader is not able to deserialize a received sample. This happens when any of the following conditions is true:

  • The DataWriter and DataReader have different data-type definitions (IDL) for the same topic.
  • An enumeration field has an invalid value.
You can find more information related to this issue in the following solution of the RTI Community Portal:

https://community.rti.com/kb/what-causes-prespsreaderqueuestorequeueentrydeserialize-messages

From the first line of the whole warning message, “[…]:invalid enumerator value ”, I think that on your case the source of the issue could be related to setting an invalid literal to an enum field. Please, check this on your side and let me know how it goes.
 
Best Regards,
      David Morales

 

Offline
Last seen: 11 months 3 weeks ago
Joined: 11/28/2016
Posts: 7

Hi Bonjefir,

A second possible source of your issue comes from an internal bug. When you run on a little endian machine, the value of RTI_CDR_ENCAPSULATION_ID_CDR_NATIVE is not correctly defined. If that is the case, you have three options:

  • Define the variableRTI_ENDIAN_LITTLEin your code
  • Compile with the option-DRTI_LITTLE_ENDIAN
  • ChangeRTI_CDR_ENCAPSULATION_ID_CDR_NATIVEforRTI_CDR_ENCAPSULATION_ID_CDR_LE
If the previous solution did not solve this issue, could you try this option?
 
Best Regards,
David Morales