Getting OutOfMemoryException :Permgern space issue in jenkins - eclipse

I am getting OutOfMemoryExeption:Permgern space issue when building a Maven project in Jenkins.
At the end of the building process message is showing as "Build Success" .But after that line below error msg is printing.
Fatal Error : Permgern space
Once this exception comes ,every time whole Jenkins is getting hanged i.e no
corresponding page of Jenkins even if dash board is not opening.
Below is the Command Line argument error for Jenkins.
Java HotSpot(TM) 64-bit Server VM Warning : Exception java.lang.OutOfMemoryError
occured dispatching signal unknown to handler - The VM may need to forcibly terminated.
Below is the error details from the console O/P of job-
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building EmployeeInformation 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
**[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.161 s
[INFO] Finished at: 2016-09-11T00:55:52+05:30
[INFO] Final Memory: 5M/76M**
[INFO] ------------------------------------------------------------------------
Parsing POMs
Established TCP socket on 49708
[Employee_Management] $ "C:\Program Files\Java\jdk1.7.0_03/bin/java" -cp "C:\Users\pc\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven32-agent-1.7.jar;C:\Program Files\Apache\maven\apache-maven-3.3.9\boot\plexus-classworlds-2.5.2.jar;C:\Program Files\Apache\maven\apache-maven-3.3.9/conf/logging" jenkins.maven3.agent.Maven32Main "C:\Program Files\Apache\maven\apache-maven-3.3.9" C:\Users\pc\.jenkins\war\WEB-INF\lib\remoting-2.62.jar C:\Users\pc\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven32-interceptor-1.7.jar C:\Users\pc\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-**commons-1.7.jar 49708
FATAL: PermGen space
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
FATAL: PermGen space**
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at jenkins.maven3.agent.Maven32Main.main(Maven32Main.java:144)
at jenkins.maven3.agent.Maven32Main.main(Maven32Main.java:74)
Caused by: java.io.EOFException: unexpected stream termination
at hudson.remoting.ChannelBuilder.negotiate(ChannelBuilder.java:365)
at hudson.remoting.ChannelBuilder.build(ChannelBuilder.java:310)
at hudson.remoting.Launcher.main(Launcher.java:530)
at hudson.remoting.Launcher.main(Launcher.java:513)
at hudson.remoting.Launcher.main(Launcher.java:504)
at hudson.remoting.Launcher.main(Launcher.java:500)
... 6 more
Below are some of the possible steps I tried to solve-
(1)In POM.XML below tag added.
attached image link for Changed permgern space configuration in POM.xml
(2)Set JAVA_OPTS in enviroment variable.
attached image link for setting enviromental variables
But,unfortunately none of them working.Still issue is there.
After searching some where,I got to know
-XX:PermSize=256m -XX:MaxPermSize=512m declaration will resolve the issue.But I am not sure Where and How to give the above declaration.
Guys,Plz go through the above links I attached and let me know If any thing I did wrong.
Any help will be appreciated.
BR//
Abinash

Add your options to the _JAVA_OPTIONS environment variable -- this will work for sure.
Otherwise, for customizing the compiler options in your Maven build environment, there's several possibilities. See this question for an overview.

Related

Strange exception in SBT test

I am facing an issue with SBT (version 0.13.9). One of my ScalaTest tests fails not deterministic with EOFException.
Stack trace:
Exception in thread "Thread-155" Exception in thread "Thread-159" java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2601)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1319)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
at sbt.React.react(ForkTests.scala:114)
at sbt.ForkTests$$anonfun$mainTestTask$1$Acceptor$2$.run(ForkTests.scala:74)
at java.lang.Thread.run(Thread.java:745)
java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2601)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1319)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
at org.scalatest.tools.Framework$ScalaTestRunner$Skeleton$1$React.react(Framework.scala:953)
at org.scalatest.tools.Framework$ScalaTestRunner$Skeleton$1.run(Framework.scala:942)
at java.lang.Thread.run(Thread.java:745)
sbt.ForkMain 59974 failed with exit code 134
I don't see any JVM logs or thread dumps.
Almost certainly this is related to the Java classpath being too long when invoking sbt.ForkMain in certain linux distros. To avoid this I added
javaOptions in Test ++= Seq("-Xms1G","-XX:+CMSClassUnloadingEnabled","-XX:+UseConcMarkSweepGC")
to the build.sbt file. I reckon CMSClassUnloadingEnabled is where the magic happens.
SBT single thread or multi threaded tests forks the JVM and if the host name is not resolved it just fails with this error message. If you look at the logs in the tests, you might see
Uncaught exception when running tests: java.net.ConnectException: Operation timed out
So the easy way to resolve this is to add your hostname to the /etc/hosts and map it to localhost something like this
::1 localhost blahblah
This should resolve the issue.

typesafe activator ui not launching

play.api.Application$$anon$1: Execution exception[[IllegalArgumentException: req
uirement failed: Source file 'C:\Users\shriv_000\.activator\1.3.6\templates\inde
x.db_e25b80033130c08.tmp' is a directory.]]
at play.api.Application$class.handleError(Application.scala:296) ~[play_
2.11-2.3.9.jar:2.3.9]
at play.api.DefaultApplication.handleError(Application.scala:402) [play_
2.11-2.3.9.jar:2.3.9]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$14$$anonfu
n$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:205) [play_2.11-2.3.9.jar
:2.3.9]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$14$$anonfu
n$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:202) [play_2.11-2.3.9.jar
:2.3.9]
at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.s
cala:36) [scala-library.jar:0.13.8]
Caused by: java.lang.IllegalArgumentException: requirement failed: Source file '
C:\Users\shriv_000\.activator\1.3.6\templates\index.db_e25b80033130c08.tmp' is a
directory.
at scala.Predef$.require(Predef.scala:219) ~[scala-library.jar:0.13.8]
at sbt.IO$.copyFile(IO.scala:584) ~[client-all-2-11-0.3.5.jar:0.3.5]
at sbt.IO$.move(IO.scala:786) ~[client-all-2-11-0.3.5.jar:0.3.5]
at activator.package$RichIO$.createViaTemporary$extension(package.scala:
30) ~[activator-templates-cache-1.0-a0afb008ea619bf9d87dc010156cddffa8a6f880.jar
:1.3.6]
at activator.templates.repository.UriRemoteTemplateRepository$$anonfun$r
esolveIndexTo$1.apply(UriRemoteTemplateRepository.scala:228) ~[activator-templat
es-cache-1.0-a0afb008ea619bf9d87dc010156cddffa8a6f880.jar:1.0-a0afb008ea619bf9d8
7dc010156cddffa8a6f880]
[info] application - onStop received closing down the app
I am at activator 1.3.6
I have seen TypeSafe Activator installation error and it might be different then my problem. I have been able to create and launch a play project.
The solution provided there did not work for me.
I see this problem frequently.
I found a workaround. Try to execute activator as an administrator.

typesafe activator dependency error

I just download the last activator version (version 1.2.12 - offline distribution) and I have found some errors in dependency when I follow the documentation in order to create a new scala project (https://www.playframework.com/documentation/2.3.x/NewApplication).
How can I get the unresolved dependency?
Can I install like mvn:install the missing dependency?
[info] Updating {file:/home/myhome/workspaceScala/play-scala/project/}play-scala-build...
[info] Resolving com.typesafe.play#routes-compiler_2.10;2.3.8 ...
[error] Server access Error: Connection timed out url=http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.play/routes-compiler_2.10/2.3.8/ivys/ivy.xml
[error] Server access Error: Connection timed out url=http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.play/routes-compiler_2.10/2.3.8/jars/routes-compiler_2.10.jar
[info] Resolving commons-io#commons-io;2.0.1 ...
[error] Server access Error: Connection timed out url=http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/commons-io/commons-io/2.0.1/ivys/ivy.xml
[info] Resolving com.typesafe.play#sbt-run-support_2.10;2.3.8 ...
[error] Server access Error: Connection timed out url=http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.play/sbt-run-support_2.10/2.3.8/ivys/ivy.xml
[error] Server access Error: Connection timed out url=http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.play/sbt-run-support_2.10/2.3.8/jars/sbt-run-support_2.10.jar
Thank you singhakash and Sarvesh, it is a network problem.
I think the best solution is to set environment variable ACTIVATOR_OPTS.
I add this line to my .bashrc file (~/.bashrc):
export ACTIVATOR_OPTS="-Dhttp.proxyUser=MyProxyAccount -Dhttp.proxyPassword=MyProxyPwd -Dhttp.proxyHost=MyProxyIp -Dhttp.proxyPort=MyProxyPort"
Thanks a lot

EBean with Scala on SBT (InterruptedException: sleep interrupted)

I am trying to run EBean with Scala on SBT and I get an error.
This is the code (a test from: http://www.avaje.org/ebean/getstarted_props.html#test):
object Main extends App {
val sql = "select count(*) as count from dual"
val row = Ebean.createSqlQuery(sql).findUnique()
val i = row.getInteger("count")
println("Got " + i + " - DataSource good.")
}
This is the error:
[info] Loading project definition from /Volumes/etam/lift/hello-ebean/project
[info] Set current project to Main (in build file:/Volumes/etam/lift/hello-ebean/)
[info] Running hello.Main
2012-06-30 09:36:51 com.avaje.ebeaninternal.server.core.BootupClassPathSearch search
INFO: Classpath search hits in jars[ebean-2.7.7.jar] pkgs[com.avaje.ebeaninternal.server.bean, com.avaje.ebean.meta] searchTime[51]
2012-06-30 09:36:51 com.avaje.ebeaninternal.server.lib.sql.DataSourcePool initialise
INFO: DataSourcePool [h2] autoCommit[false] transIsolation[READ_COMMITTED] min[1] max[25]
2012-06-30 09:36:51 com.avaje.ebeaninternal.server.core.DefaultServerFactory setDatabasePlatform
INFO: DatabasePlatform name:h2 platform:h2
2012-06-30 09:36:51 com.avaje.ebeaninternal.server.subclass.SubClassManager$1 run
INFO: SubClassFactory parent ClassLoader [sbt.classpath.ClasspathUtilities$$anon$1]
2012-06-30 09:36:51 com.avaje.ebeaninternal.server.deploy.DeployOrmXml findAllOrmXml
INFO: Deployment xml [orm.xml] loaded.
2012-06-30 09:36:51 com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager logStatus
INFO: Entities enhanced[0] subclassed[0]
runScript
executing 1 of 2 SET REFERENTIAL_INTEGRITY FALSE
executing 2 of 2 SET REFERENTIAL_INTEGRITY TRUE
... end of script
runScript
... end of script
2012-06-30 09:36:51 com.avaje.ebeaninternal.server.transaction.log.FileTransactionLoggerWrapper initialiseLogger
INFO: Transaction logs in: logs
Got 0 - DataSource good.
2012-06-30 09:36:51 com.avaje.ebeaninternal.server.lib.BackgroundThread$Runner run
SEVERE: null
java.lang.InterruptedException: sleep interrupted
at java.lang.Thread.sleep(Native Method)
at com.avaje.ebeaninternal.server.lib.BackgroundThread$Runner.run(BackgroundThread.java:168)
at java.lang.Thread.run(Thread.java:680)
2012-06-30 09:36:51 com.avaje.ebeaninternal.server.transaction.log.FileTransactionLogger run
INFO: Interrupted TxnLogBufferWriter
java.lang.InterruptedException: sleep interrupted
at java.lang.Thread.sleep(Native Method)
at com.avaje.ebeaninternal.server.transaction.log.FileTransactionLogger.run(FileTransactionLogger.java:206)
at java.lang.Thread.run(Thread.java:680)
[success] Total time: 1 s, completed 2012-06-30 09:36:51
What is wrong with the project?
GIT repository: https://github.com/odwrotnie/hello-ebean;
main class: https://github.com/odwrotnie/hello-ebean/blob/master/main/src/main/scala/hello/main.scala;
config: https://github.com/odwrotnie/hello-ebean/blob/master/main/src/main/resources/ebean.properties.
Thanks in advance,
Etam.
By default, run executes the application in the same jvm as sbt itself for faster turnaround time. In this case, run thinks there are only daemon threads left after the main method terminates. It proceeds to interrupt those remaining threads, which gives the exceptions you see. It has to do it this way because this is the best it can do to fake a jvm shutdown without actually shutting it down.
Those exceptions don't look too harmful, but you can get rid of them by running the application in a forked jvm. To enable this, add the following to your build settings
fork in run := true
How sbt runs project code in the same jvm is described here: http://www.scala-sbt.org/release/docs/Detailed-Topics/Running-Project-Code.html
Forking is described here: http://www.scala-sbt.org/release/docs/Detailed-Topics/Forking.html

Problem install lift framework on Fedora

I'm trying to start the lift_basic project from the latest version of lift (2.4-M1).
I'm following the docs - untarred the tarball, then changed into scala_29/lift_basic and ran ./sbt update but it fails with:
Getting Scala 2.7.7 ...
:: retrieving :: org.scala-tools.sbt#boot-scala
confs: [default]
2 artifacts copied, 0 already retrieved (9911kB/112ms)
Getting org.scala-tools.sbt sbt_2.7.7 0.7.5 ...
:: retrieving :: org.scala-tools.sbt#boot-app
confs: [default]
16 artifacts copied, 0 already retrieved (4271kB/107ms)
[info] Recompiling project definition...
[info] Source analysis: 1 new/modified, 0 indirectly invalidated, 0 removed.
sbt.UndefinedValue: Value for property '<unnamed>' from /var/www/html/projects/lift/lift-lift_24_sbt-14a1743/scala_29/lift_basic/project/build.properties is undefined.
at sbt.BasicEnvironment$UserProperty.sbt$BasicEnvironment$UserProperty$$inheritedValue(Environment.scala:155)
at sbt.BasicEnvironment$UserProperty$$anonfun$resolveDefaultFirst$1.apply(Environment.scala:135)
at sbt.BasicEnvironment$UserProperty$$anonfun$resolveDefaultFirst$1.apply(Environment.scala:135)
at sbt.BasicEnvironment$UserProperty.sbt$BasicEnvironment$UserProperty$$getDefault(Environment.scala:143)
at sbt.BasicEnvironment$UserProperty.resolveDefaultFirst(Environment.scala:135)
at sbt.BasicEnvironment$UserProperty.resolve(Environment.scala:120)
at sbt.Environment$Property.value(Environment.scala:16)
at LiftProject.<init>(LiftProject.scala:4)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at sbt.Project$.constructProject(Project.scala:391)
at sbt.Project$$anonfun$9.apply(Project.scala:365)
at sbt.Project$$anonfun$9.apply(Project.scala:364)
at scala.Either$RightProjection.map(Either.scala:239)
at sbt.Project$.loadProject(Project.scala:364)
at sbt.Project$.loadProject(Project.scala:355)
at sbt.Project$.loadProject(Project.scala:343)
at sbt.Project$.loadProject(Project.scala:340)
at sbt.xMain.run(Main.scala:47)
at sbt.xMain.run0$1(Main.scala:35)
at sbt.xMain.run(Main.scala:42)
at xsbt.boot.Launch$.run(Launch.scala:53)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:42)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:42)
at xsbt.boot.Launch$.launch(Launch.scala:57)
at xsbt.boot.Launch$.explicit(Launch.scala:42)
at xsbt.boot.Launch$.initialized(Launch.scala:38)
at xsbt.boot.Launch$.parsed(Launch.scala:31)
at xsbt.boot.Launch$.configured(Launch.scala:21)
at xsbt.boot.Launch$.apply(Launch.scala:16)
at xsbt.boot.Launch$.apply(Launch.scala:13)
at xsbt.boot.Boot$.runImpl(Boot.scala:24)
at xsbt.boot.Boot$.run(Boot.scala:19)
at xsbt.boot.Boot$.main(Boot.scala:15)
at xsbt.boot.Boot.main(Boot.scala)
Error loading project: sbt.UndefinedValue: Value for property '<unnamed>' from /var/www/html/projects/lift/lift-lift_24_sbt-14a1743/scala_29/lift_basic/project/build.properties is undefined.
Does anyone know where I'm going wrong?
Thanks
I just tried this out myself (on Ubuntu 10.04) and I'm getting the exact same error. It's attempting to get a build configuration property and for some reason failing. I don't know enough about the SBT internals to offer a full solution, but I can show you how to get around it for now.
Simply open up the project/build/LiftProject.scala and on line 4, change
val liftVersion = property[Version].value.toString
to
val liftVersion = "2.4-M3" //use the value in project/build.properties for lift.version
After I did this, SBT was able to update and the example project compiled and ran without error.