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

Confluence Publisher: leaking threads when using publishConfluence()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • Jenkins 2.290, confluence-publisher-plugin: v2.0.6

      We noticed leaking threads in the publishConfluence() method which adds 3 threads with each call to the thread pool and never give it back properly.

      Over time we're ending up with thousands of unused threads and this kind of exceptions:

      java.lang.OutOfMemoryError: unable to create new native thread

      As a workaround, we were able to increase this limit, but we're still reaching it after some time without a restart.
       

      Pipeline example code:

      for (int i = 0; i < 1000; i++) {
          publishConfluence(
              editorList: [
                  confluenceAfterToken(generator: confluenceText('.'), markerToken: 'my-marker')
              ],
              pageName: 'PageTest',
              siteName: 'confluence.example.de',
              spaceName: 'TestSpace'
          )
      }
      

       

      Result
      I added a graph with the open threads of the master Jenkins process.
      The first peak to ~3k was caused with the code above (adding 3k ".").
      Afterwards we did a clean restart.
      Then I built a version with this changed line in ConfluenceSession.java:

      private final ListeningExecutorService executor = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(1));

      -> Next run was only leaking 1k threads which somehow sounds like unclosed/enqueue is missing in the ConfluenceSession.

            jhansche Joe Hansche
            brainexe Matthias
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: