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

STREAMING_STATE_TRANSFER: use_default_transport might lead to incorrect state transfer

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 3.0
    • None
    • None
    • Workaround Exists
    • Hide

      Set STREAMING_STATE_TRANSFER.use_default_transport=false for now

      Show
      Set STREAMING_STATE_TRANSFER.use_default_transport=false for now

      If read(byte[] buf, int offset, int len) is invoked on a StateInputStream, we do the following:

      • stateQueue.take() is called to grab the next message (block if no message is available)
      • Then we return the byte[] buffer of the message. The number of bytes returned is buffer.length, not len !
        This has 3 issues:
        #1 It violates the contract of read(): if we wanted to read len bytes at most, we cannot get more bytes back. E.g. if we wanted to read 500 bytes, but get 1000 back, then that's incorrect
        #2 If we allocate a buffer of 500 bytes, but the next message has 1000 bytes, we will get an array out of bounds exception
        #3 Even if this was correct, if we wanted to read 500 bytes, but the next message has 1000 bytes, we'd only read 500 bytes and throw the remainder away !

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

              Created:
              Updated:
              Resolved: