-
Bug
-
Resolution: Fixed
-
Minor
-
-
Jenkins 2.181
The threads in the thread pool used for Proc.joinWithTimeout inherit their context class loader from the thread that calls Proc.joinWithTimeout, which seems undesirable. While looking into JENKINS-50223, I found a case where one of the threads in the thread pool was holding onto a CleanGroovyClassLoader class loader from workflow-cps (see the attached screenshot), which is definitely undesirable.
We should wrap this thread pool in ClassLoaderSanityThreadFactory to prevent this kind of issue from happening.
- links to
This was mentioned in the LTS changelog for v2.176.2, but I'm experiencing something related. My Jenkins system with 20 executors will creep towards 20k Tasks (processes + threads) before it hits the systemd imposed DefaultTasksMax limit of 19660 on my system.
A java heap dump shows that 4675 of the total 4877 match the expression Timer-.* and have the Context Class Loader-> org.jenkinsci.plugins.workflow.cps.CpsGroovyShell$CleanGroovyClassLoader.
Bottom right corner of my Jenkins UI confirms I'm running the latest version (Jenkins ver. 2.176.2)with all plugins updated on OpenJDK Runtime Environment (build 1.8.0_222-b05) with. Ubuntu 18.04