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

DefaultSocketFactory: failed socket creations lead to sockets lingering in hashmap

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 3.0.4, 3.1
    • None
    • None

      In TCPConnectionMap.TCPConnection(), the following code is executed:
      sock=socketFactory.createSocket(); // (1)
      sock.bind(); // (2)
      sock.connect(); // (3)

      In the first step, an unconnected socket is created and added to the 'sockets' hashmap in DefaultSocketFactory. This is used to dump the open sockets in a JGroups program (e.g. via probe.sh socks).

      However, if step (3) fails, e.g. because the destination is not reachable, the socket should be removed from the 'sockets' hashmap, but isn't !

      SOLUTIUON:
      #1 Check all occurrences of this or similar code and make sure exceptions don't lead to lingering sockets
      #2 Make the 'sockets' hashmap a weak hashmap, so refs can be GC'ed when memory is low
      #3 Store string reps of the sockets rather than the sockets themselves

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

                Created:
                Updated:
                Resolved: