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

Gossip Router can corrupt data

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Blocker Blocker
    • 5.2.17
    • 5.2.16
    • None
    • Critical

      In OCP environment, the Gossip Router DNS name may resolve to multiple IPs. The TUNNEL protocol creates a different connection using each of those IPs however, the following code is not ready to handle that case, which can overlap messages in the same byte array, leading to corruption.

      ByteArrayDataOutputStream out=getOutputStream(request.sender, request.serializedSize());
      out.position(0);
      request.writeTo(out);
      route(request.group, request.addr, out.buffer(), 0, out.position());
      

      Source code link: https://github.com/belaban/JGroups/blob/f655d9d340f5f3a0b620cf422a0736f7fb6ed160/src/org/jgroups/stack/GossipRouter.java#L352-L355

      To debug, I put one print at the beginning and one at the end, printing the thread name and the ByteArrayDataOutputStream identity hash code. Got the following sequence of events where it shows 2 threads using the same ByteArrayDataOutputStream concurrently.

      Thread Connection.Receiver [10.0.2.100:7900 - 10.0.2.100:59298]-4 start using 1488737374
      Thread Connection.Receiver [10.0.2.100:7900 - 10.0.2.100:59284]-3 start using 1488737374
      Thread Connection.Receiver [10.0.2.100:7900 - 10.0.2.100:59298]-4 stopped using 1488737374
      Thread Connection.Receiver [10.0.2.100:7900 - 10.0.2.100:59284]-3 stopped using 1488737374
      removed _ea0231e55bec-47524 (10.0.2.100:42052) from group xsite
      

              pruivo@redhat.com Pedro Ruivo
              pruivo@redhat.com Pedro Ruivo
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: