-
Bug
-
Resolution: Fixed
-
Critical
-
Operating System: Ubuntu 14.04.2 LTS, 64 bit, java version "1.7.0_80", Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode), Jenkins ver. 1.580.3, Global Post Script Plugin (1.1.0)
start Jenkins by the following command (jenkins.war is downloaded from Jenkins website):
/usr/lib/jvm/java-7-oracle/bin/java -XX:MaxPermSize=128M -jar jenkins.war --httpPort=8093
no reverse proxy, no slaveOperating System: Ubuntu 14.04.2 LTS, 64 bit, java version "1.7.0_80", Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode), Jenkins ver. 1.580.3, Global Post Script Plugin (1.1.0) start Jenkins by the following command (jenkins.war is downloaded from Jenkins website): /usr/lib/jvm/java-7-oracle/bin/java -XX:MaxPermSize=128M -jar jenkins.war --httpPort=8093 no reverse proxy, no slave
We have recently experienced OutOfMemory errors on some large Jenkins instances that predominantly have frequently executed jobs that contain either System Groovy scripts or Build Flow project types. In one case after disabling a groovy script that was being executed via the Global Post Script Plugin after every build, the PermGen profile improved dramatically.
We tested further with GroovyShell to run a groovy script, not depending on Jenkins.
Java7: java.lang.OutOfMemoryError: PermGen space
Java8: java.lang.OutOfMemoryError: Java heap space
The tests use 2.4.6 version of groovy which is the latest version. However, the issue is still there.
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.6</version>
</dependency>
---------------------------------------
Configure 10 jobs which build per minute
Each build triggers a groovy script by Global Post Script Plugin.
class Main { static void main(String... args) { println 'Groovy world!' def p = new Person() p.write() } } class Person { def write(){ println 'i am writing ...!' } }
After sometime, the perm gen is eaten up. See the screenshot of jvisualvm.
I checked the source code of the plugin:
https://github.com/jenkinsci/global-post-script-plugin/blob/master/src/main/java/com/orctom/jenkins/plugin/globalpostscript/ScriptExecutor.java
My feeling is that it is probably caused by GroovyShell. Jenkins loads and runs groovy extensively and maybe there are places in core or other plugins having similar logic, I wonder
1. if this is a potential memory leak, and
2. if anyone has met similar issue.
- is blocked by
-
JENKINS-42189 Groovy 2.4.8 interoperability issues
- Resolved
- is duplicated by
-
JENKINS-38503 Jenkins memory leak (Metaspace increases over the period)
- Resolved
- is related to
-
JENKINS-42637 Jenkins stuck UI does not open at all
- Resolved
-
JENKINS-37213 java.lang.OutOfMemoryError: Compressed class space in Job DSL
- Closed
- relates to
-
JENKINS-38334 Jenkins (master) hangs; high cpu-load w/o running jobs
- Resolved
- links to