What might cause a segmentation fault while reading data? Why do I see an unexpected data sequence length?

Note: Applies to RTI Data Distribution Service 4.1 and 4.2

If a non-keyed DataReader calls take() or read() while max_samples (in the ResourceLimitsQosPolicy) is LENGTH_UNLIMITED (the default), and, the available data is greater than max_samples_per_read (in the DataReaderResourceLimitsQosPolicy), the middleware may step outside of the data sequence boundary, resulting in corrupt data or even a segmentation fault.

This is a known issue with a simple workaround: Instead of using the default value for max_samples ( LENGTH_UNLIMITED), set it to the same value used for max_samples_per_read (1024 by default).