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

FRAG/FRAG2: message batching can lead to incorrect ordering

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Done
    • Critical
    • 3.3.3, 3.4
    • None
    • None
    • 0
    • 0% 0%

    Description

      The implementation of up(MessageBatch) in FRAG and FRAG2 is incorrect because messages reassmbled from fragments are re-inserted into the batch at the end rather than in the place of the fragments.
      Example: when we receive P1 P2 P3:1 P3:2 P3:3 and P4 (P3 was split into 3 fragments by sender P), then the resulting batch (see the code below) will be P1 P2 P4 P3, as the re-assembled message P3 is added to the end of the batch rather than re-inserted in-place.

          public void up(MessageBatch batch) {
              for(Message msg: batch) {
                  FragHeader hdr=(FragHeader)msg.getHeader(this.id);
                  if(hdr != null) { // needs to be defragmented
                      batch.remove(msg);
                      Message assembled_msg=unfragment(msg,hdr);
                      if(assembled_msg != null)
                          batch.add(assembled_msg); // the newly added message will not get iterated over by the current iterator !
                  }
              }
              if(!batch.isEmpty())
                  up_prot.up(batch);
          }
      

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: