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

JenkinsRule: Jetty leaves stray threads running after server.stop()

XMLWordPrintable

       
      I was debugging through JenkinsRule from Jenkins Test Harness. After the Jetty server and Jenkins have both been terminated in JenkinsRule#after() (line 488 and line 502, respectively) stray threads keep running. Attached is the dump of the running threads. Is it possible to terminate these threads to allow the JVM to exit gracefully?
       
      This issue may already have been reported before in this Stack Overflow question: https://stackoverflow.com/questions/13769007/jetty-server-leaves-behind-threads-after-stop
       
      A minimal example would be following test code and setting a breakpoint at the System.gc() call on line 517:
       

      import org.junit.Rule;
      import org.junit.Test;
      import org.jvnet.hudson.test.JenkinsRule;
      
      public class RandomTest {
          @Rule
          public JenkinsRule jenkinsRule = new JenkinsRule();
      
          @Test
          public void randomTest() {
              System.out.println("Hello world");
          }
      }
      

       
      I was able to confirm the behaviour with the latest Jetty on both Windows 10 and Linux.
       
      This issues was discussed on the developer mailing list: https://groups.google.com/forum/#!topic/jenkinsci-dev/7yL0MKjxQwA

            olivergondza Oliver Gondža
            abhyudaya Abhyudaya Sharma
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: