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

39 views
Skip to first unread message

Abhyudaya Sharma

unread,
May 24, 2019, 12:35:55 PM5/24/19
to Jenkins Developers
Hi everyone!

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");
    }
}



Thanks 
Abhyudaya Sharma
threads_report.txt

Olivier Lamy

unread,
May 24, 2019, 11:50:38 PM5/24/19
to jenkin...@googlegroups.com
Hi
Do you have same issue when using an other OS (i.e not windows)?
I remember some issues with selector on windows.
What are jetty version and jdk version?

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/69803027-2066-4650-837e-b922f86d7531%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

Abhyudaya Sharma

unread,
May 25, 2019, 1:19:22 AM5/25/19
to jenkin...@googlegroups.com
Hi

I was able to confirm the same behavior on Kubuntu 19.04 on Oracle JDK 1.8.0_181. I had originally run it on Windows 10 using the same version of the JDK. Jetty is 9.4.5v20170502.

You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/7yL0MKjxQwA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAPoyBqTUvauHOU3xBN0Obgn75ukvkGhad68N2Lvrcc3rH33LxA%40mail.gmail.com.

Olivier Lamy

unread,
May 25, 2019, 6:53:44 PM5/25/19
to jenkin...@googlegroups.com
can you upgrade to last Jetty 9.4.18.v20190429? and tell us if you have same issue


For more options, visit https://groups.google.com/d/optout.

Abhyudaya Sharma

unread,
May 26, 2019, 1:54:37 AM5/26/19
to jenkin...@googlegroups.com
Hi

Yes, I was able to confirm it on both Linux and Windows with the latest Jetty.

Thanks
Abhyudaya Sharma

Baptiste Mathus

unread,
May 30, 2019, 4:38:51 PM5/30/19
to Jenkins Developers
Can you please file a JIRA with details you found and reproducer?

Thanks!

Abhyudaya Sharma

unread,
May 30, 2019, 11:51:55 PM5/30/19
to jenkin...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages