Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-30333

Thread Leak due to use of deprecated JiraSize.createSession

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      We use the 2.0 Jira Plugin to add comments to Jiras. We have the problem that every such request causes a Thread Leak - see the "diff" output of "jstack" below.

      Seems that this is caused by using JiraSite.createSession instead of getSession() in Updater class. Changing it to getSession worked for me.
      Mind that I havent yet tested for the "// TODO: we should check for session timeout, too" in JiraSite.


      Output of the thread-list diff - we can see many additional "httpclient-" threads

      glangs@cgm-1194:/opt/docker_volumes/jenkins3$ diff *tid
      1c1,20
      < "httpclient-callbacks:thread-1" daemon prio=10 tid=0x0000000000c83800 nid=0x5364 waiting on condition [0x00007ff7a73f2000]
      ---
      > "RequestHandlerThread[#12]" daemon prio=10 tid=0x00007ff7a800b800 nid=0x53c2 waiting on condition [0x00007ff7a67e6000]
      > "httpclient-callbacks:thread-1" daemon prio=10 tid=0x0000000000bf6000 nid=0x53c0 waiting on condition [0x00007ff7a68e7000]
      > "httpclient-io:thread-10" daemon prio=10 tid=0x0000000000ae8800 nid=0x53bf runnable [0x00007ff7a69e8000]
      > "httpclient-io:thread-9" daemon prio=10 tid=0x0000000000913000 nid=0x53be runnable [0x00007ff7a6ae9000]
      > "httpclient-io:thread-8" daemon prio=10 tid=0x0000000000910800 nid=0x53bd runnable [0x00007ff7a6bea000]
      > "httpclient-io:thread-7" daemon prio=10 tid=0x000000000090e800 nid=0x53bc runnable [0x00007ff7a6ceb000]
      > "httpclient-io:thread-6" daemon prio=10 tid=0x000000000090d000 nid=0x53bb runnable [0x00007ff7a6dec000]
      > "httpclient-io:thread-5" daemon prio=10 tid=0x0000000000909800 nid=0x53ba runnable [0x00007ff7a6eed000]
      > "httpclient-io:thread-4" daemon prio=10 tid=0x0000000000908000 nid=0x53b9 runnable [0x00007ff7a6fee000]
      > "httpclient-io:thread-3" daemon prio=10 tid=0x0000000000904800 nid=0x53b6 runnable [0x00007ff7a70ef000]
      > "httpclient-io:thread-2" daemon prio=10 tid=0x0000000000906800 nid=0x53b5 runnable [0x00007ff7a71f0000]
      > "httpclient-io:thread-1" daemon prio=10 tid=0x0000000000967000 nid=0x53b4 runnable [0x00007ff7a72f1000]
      > "httpclient-req-killer" prio=10 tid=0x00007ff7d80d8000 nid=0x53b3 waiting on condition [0x00007ff7ac122000]
      > "Thread-333" prio=10 tid=0x00007ff7d837c000 nid=0x53ae runnable [0x00007ff7a7cfb000]
      > "Jenkins-Remoting-Thread-312" daemon prio=10 tid=0x000000000098d000 nid=0x53ad waiting on condition [0x00007ff7a73f2000]
      > "Jenkins-Remoting-Thread-311" daemon prio=10 tid=0x0000000000c83800 nid=0x53ac waiting on condition [0x00007ff7a7ffe000]
      > "Jenkins-Remoting-Thread-310" daemon prio=10 tid=0x0000000000986800 nid=0x53ab waiting on condition [0x00007ff7a7dfc000]
      > "Jenkins-Remoting-Thread-309" daemon prio=10 tid=0x00007ff7b807a800 nid=0x53aa waiting on condition [0x00007ff7a7bfa000]
      > "process reaper" daemon prio=10 tid=0x00007ff7d8075000 nid=0x53a2 waiting on condition [0x00007ff7acc74000]
      > "pool-16-thread-375" daemon prio=10 tid=0x0000000000de9000 nid=0x5399 waiting on condition [0x00007ff7ae1e1000]
      14,17d32
      < "RequestHandlerThread[#11]" daemon prio=10 tid=0x00007ff7a800b800 nid=0x5355 waiting on condition [0x00007ff7ae1e1000]
      < "Jenkins-Remoting-Thread-308" daemon prio=10 tid=0x0000000000986800 nid=0x5352 waiting on condition [0x00007ff7a7bfa000]
      < "Jenkins-Remoting-Thread-307" daemon prio=10 tid=0x0000000000967800 nid=0x5351 waiting on condition [0x00007ff7a7cfb000]
      < "Jenkins-Remoting-Thread-306" daemon prio=10 tid=0x000000000098d000 nid=0x5350 waiting on condition [0x00007ff7a7dfc000]
      19d33
      < "process reaper" daemon prio=10 tid=0x0000000000de9000 nid=0x5339 waiting on condition [0x00007ff7acc74000]
      21d34
      < "Jenkins-Remoting-Thread-305" daemon prio=10 tid=0x00007ff7bcb79800 nid=0x5332 waiting on condition [0x00007ff7a7ffe000]
      23d35
      < "pool-16-thread-372" daemon prio=10 tid=0x00007ff7d8056000 nid=0x52b6 waiting on condition [0x00007ff7ac122000]
      glangs@cgm-1194:/opt/docker_volumes/jenkins3$
      
      

        Attachments

          Activity

          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Gerhard Langs
          Path:
          src/main/java/hudson/plugins/jira/JiraSite.java
          http://jenkins-ci.org/commit/jira-plugin/f6d0f1fc927fcd373dd05eada22dd87a24a2fe0b
          Log:
          JENKINS-30333 use direct references instead of WeakReference, added createSession logging

          Conflicts:
          src/main/java/hudson/plugins/jira/JiraSite.java

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Gerhard Langs Path: src/main/java/hudson/plugins/jira/JiraSite.java http://jenkins-ci.org/commit/jira-plugin/f6d0f1fc927fcd373dd05eada22dd87a24a2fe0b Log: JENKINS-30333 use direct references instead of WeakReference, added createSession logging Conflicts: src/main/java/hudson/plugins/jira/JiraSite.java
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Gerhard Langs
          Path:
          src/main/java/hudson/plugins/jira/JiraSite.java
          http://jenkins-ci.org/commit/jira-plugin/f238b971bca8f682040e0344dc4e8778fd7da112
          Log:
          JENKINS-30333 use direct references instead of WeakReference, added createSession logging

          Conflicts:
          src/main/java/hudson/plugins/jira/JiraSite.java

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Gerhard Langs Path: src/main/java/hudson/plugins/jira/JiraSite.java http://jenkins-ci.org/commit/jira-plugin/f238b971bca8f682040e0344dc4e8778fd7da112 Log: JENKINS-30333 use direct references instead of WeakReference, added createSession logging Conflicts: src/main/java/hudson/plugins/jira/JiraSite.java
          Hide
          walterk82 Walter Kacynski added a comment -

          What happens if the session expires and a new login token has to be acquired? It seems like the WeakReference caused this to be refreshed at a random interval.

          Show
          walterk82 Walter Kacynski added a comment - What happens if the session expires and a new login token has to be acquired? It seems like the WeakReference caused this to be refreshed at a random interval.
          Show
          gerhard6 gerhard6 added a comment - @Walter: my knowledge/assumption and related test is described in the comments above: https://issues.jenkins-ci.org/browse/JENKINS-30333?focusedCommentId=236862&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-236862 https://issues.jenkins-ci.org/browse/JENKINS-30333?focusedCommentId=236762&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-236762
          Hide
          walterk82 Walter Kacynski added a comment -

          Sorry I missed that, thanks.

          Show
          walterk82 Walter Kacynski added a comment - Sorry I missed that, thanks.

            People

            Assignee:
            warden Radek Antoniuk
            Reporter:
            gerhard6 gerhard6
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: