Uploaded image for project: 'JGroups'
  1. JGroups
  2. JGRP-2285

ObjectMessage: handle objects with incorrect size

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Won't Do
    • Major
    • 5.0.3
    • None
    • None

    Description

      An ObjectMessage accepts objects of type SizeStreamable. When such an object has an incorrect serializableSize() method, the following can happen:

      • Say the serialized size is 1000, but serializedSize() returns 1200
      • When the ObjectMessage is serialized, a length of 1200 is written, but then only 1000 bytes are serialized onto the output stream
      • On the receiving side, length=1200 is read and a byte array of 1200 is created
      • DataInput.readFully() reads 1000 bytes, but then reaches the eof of the stream, trying to read an additional 200 bytes
      • An exception is thrown and the reading of the message fails

      If we caught the exception, things would work, however this would mask other errors in the object serialization/deserialization code.

      If the serialization code was able to mark the position of the output stream, then we could write the actual number of bytes written (especially if it differs from serializedSize()); however, DataOutput doesn't give us this option!

      Investigate whether simply catching (and ignoring) the EOFException would work.

      Attachments

        Issue Links

          Activity

            People

              rhn-engineering-bban Bela Ban
              rhn-engineering-bban Bela Ban
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: