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

Timer leak in GossipClient

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • 2.3
    • 2.2.8, 2.2.9, 2.2.9.1, 2.2.9.2
    • None

      While investigating an unrelated problem with an application that has one long-lived jgroups member and four other processes that often close their channel and create a new one, I found that GossipClient is leaking Timers. The GossipClient.stop method seems to be responsible for this:

      public void stop()

      { timer_running=false; timer.cancel(); groups.clear(); // provide another refresh tools in case the channel gets reconnected timer=new Timer(); refresher_task=new Refresher(); }

      Adding a destroy() method in TCPGOSSIP and GossipClient seems to solve the problem:

      GossipClient.java
      public void destroy()

      { timer_running=false; timer.cancel(); groups.clear(); }

      TCPGOSSIP.java
      public void destroy() {
      if (gossip_client != null)

      { gossip_client.destroy(); gossip_client = null; }

      }

              rhn-engineering-bban Bela Ban
              bruces_jira Bruce Schuchardt (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: