M2 Release Plugin - MAVE_OPTS not picked up and getting java.lang.OutOfMemoryError: PermGen space

141 views
Skip to first unread message

Keith O'Brien

unread,
Apr 10, 2015, 11:56:59 AM4/10/15
to jenkins...@googlegroups.com
Hi all,

I have a Maven build configured on our Jenkins CI (1.608) server and the following MAVEN_OPTS configured in Build section of the job and have m2release plugin v0.14.0 installed.  

-XX:MaxPermSize=512m -Xmx2048m


When running a regular build (clean install) everything works as expected, however if I try running a Maven Release Build I'm getting the dreaded "java.lang.OutOfMemoryError: PermGen space" error. So I have tried setting up my Maven project as best possible, setting JVM args on the appropriate plugins etc, but the root of the problem seem to be that the Maven process being executed by the m2release plugin isn't picking up either the Global MAVEN_OPTS variable I have added or the values above from the job configuration, instead from the box itself I can see that the following command is being run: 

/usr/lib/jvm/jdk1.7.0_65/bin/java -Dmaven.repo.local=/var/jenkins/.m2/repository -Xmx384m -XX:MaxPermSize=192m -classpath /usr/local/maven/boot/plexus-classworlds-2.5.1.jar -Dclassworlds.conf=/usr/local/maven/bin/m2.conf -Dmaven.home=/usr/local/maven org.codehaus.plexus.classworlds.launcher.Launcher -B -D maven.repo.local=/var/jenkins/.m2/repository -s /tmp/release-settings2394907685413605920.xml -D java7.path=/usr/lib/jvm/jdk1.7.0_65/bin/java -D maven.release=true -P artifactory clean verify

.. from this the MaxPermSize is being set to 192m and not the 512m I have configured everywhere else.  To prove that this is the cause of my problem I have changed the values in this command and run it directly on the Jenkins server with a successful result. 


Can anyone tell me how I can change the JVM args on this forked maven build?

Thanks,

Keith.

James Nord

unread,
Apr 17, 2015, 2:28:54 PM4/17/15
to jenkins...@googlegroups.com
The memory arguments don't get injected randomly - so I would track down where the values 384m and 192m are set and work backwards.

If possible can you post your job config.xml and the full output of the build?

/James

Indra Gunawan (ingunawa)

unread,
Jun 23, 2015, 1:42:30 AM6/23/15
to jenkins...@googlegroups.com
I am getting the same error.

I have set the MAVEN_OPTS to the build environment section of the job via EnvInject but it is not passed to the maven release.

The m2/3 type job does clean deploy with "-Xms512m –Xmx2048m” MAVEN_OPTS.
I am setting the MAVEN_OPTS again in Build Environment -> Inject environment variables to the build process” : MAVEN_OPTS='-Xms512m -Xmx2048m -XX:PermSize=256m -XX:MaxPermSize=512m’

However the maven release is still failing with OOM PermGen.

I see this in the console:

At revision 154784
[EnvInject] - Executing scripts and injecting environment variables after the SCM step.
[EnvInject] - Injecting as environment variables the properties content 
MAVEN_OPTS='-Xms512m -Xmx2048m -XX:PermSize=256m -XX:MaxPermSize=512m’
[checkout] $ /users/px-build/commonTools/java/jdk1.7.0_67/LNX-64/bin/java -Xms512m -Xmx2048m -cp /scratch/jenkins_slave_sjc-bld62-lnx/maven3-agent.jar:/users/px-build/commonTools/maven/sjc-hudson62-lnx/apache-maven-3.0.4/boot/plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main /users/px-build/commonTools/maven/sjc-hudson62-lnx/apache-maven-3.0.4 /scratch/jenkins_slave_sjc-bld62-lnx/slave.jar /scratch/jenkins_slave_sjc-bld62-lnx/maven3-interceptor.jar /scratch/jenkins_slave_sjc-bld62-lnx/maven3-interceptor-commons.jar 38360
Executing Maven:  -B -f /scratch/jenkins_slave_sjc-bld62-lnx/workspace/comp-ps_cluster_parent-PI_3_0_NIHAU/checkout/pom.xml -Dmaven.repo.local=/scratch/jenkins_slave_sjc-bld62-lnx/workspace/comp-ps_cluster_parent-PI_3_0_NIHAU/.repository -DdevelopmentVersion=3.0.29-SNAPSHOT -DreleaseVersion=3.0.28 -e -B -Prelease-profile -DgenerateReleasePoms=true release:prepare release:perform -Dresume=false -s /users/px-build/commonTools/maven/sjc-hudson62-lnx/apache-maven-3.0.4/conf/settings-rel.xml -Dmaven.test.skip=true
-Indra

From: <jenkins...@googlegroups.com> on behalf of James Nord <james...@gmail.com>
Reply-To: "jenkins...@googlegroups.com" <jenkins...@googlegroups.com>
Date: Friday, April 17, 2015 at 11:28 AM
To: "jenkins...@googlegroups.com" <jenkins...@googlegroups.com>
Subject: Re: M2 Release Plugin - MAVE_OPTS not picked up and getting java.lang.OutOfMemoryError: PermGen space

The memory arguments don't get injected randomly - so I would track down where the values 384m and 192m are set and work backwards.

If possible can you post your job config.xml and the full output of the build?

/James



On Friday, 10 April 2015 16:56:59 UTC+1, Keith O'Brien wrote:
Hi all,

I have a Maven build configured on our Jenkins CI (1.608) server and the following MAVEN_OPTS configured in Build section of the job and have m2release plugin v0.14.0 installed.  

-XX:MaxPermSize=512m-Xmx2048m


When running a regular build (clean install) everything works as expected, however if I try running a Maven Release Build I'm getting the dreaded "java.lang.OutOfMemoryError: PermGen space" error. So I have tried setting up my Maven project as best possible, setting JVM args on the appropriate plugins etc, but the root of the problem seem to be that the Maven process being executed by the m2release plugin isn't picking up either the Global MAVEN_OPTS variable I have added or the values above from the job configuration, instead from the box itself I can see that the following command is being run: 

/usr/lib/jvm/jdk1.7.0_65/bin/java -Dmaven.repo.local=/var/jenkins/.m2/repository -Xmx384m-XX:MaxPermSize=192m-classpath /usr/local/maven/boot/plexus-classworlds-2.5.1.jar-Dclassworlds.conf=/usr/local/maven/bin/m2.conf -Dmaven.home=/usr/local/maven org.codehaus.plexus.classworlds.launcher.Launcher-B -D maven.repo.local=/var/jenkins/.m2/repository -s /tmp/release-settings2394907685413605920.xml -D java7.path=/usr/lib/jvm/jdk1.7.0_65/bin/java -D maven.release=true-P artifactory clean verify

.. from this the MaxPermSize is being set to 192m and not the 512m I have configured everywhere else.  To prove that this is the cause of my problem I have changed the values in this command and run it directly on the Jenkins server with a successful result. 


Can anyone tell me how I can change the JVM args on this forked maven build?

Thanks,

Keith.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1a3000be-3224-46a7-b24c-ce8e95b9b6b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

James Nord

unread,
Jul 4, 2015, 10:18:43 AM7/4/15
to jenkins...@googlegroups.com
Environment variables are not used as Jenkins does not run the maven helper shell but stats maven diretly with some trickery via java,
  you will need to specify the MAVEN_OPTS in the advanced section (IIRC) of the maven configuration for the job - or specify the arguments directly on the release goals and options in the release section.

/James
Reply all
Reply to author
Forward
0 new messages