StackOverflowError in JaCoCo 0.5.10 under Maven 3 from Jenkins while doing Sonar 3.2.1 analysis

1,435 views
Skip to first unread message

doug.b...@gmail.com

unread,
Oct 8, 2012, 1:03:14 PM10/8/12
to jac...@googlegroups.com, d...@beatties.us
One of our development teams has encountered a problem while building
a project under Jenkins using Maven 3 using Sonar 3.2.1 which uses
JaCoCo 0.5.10.
The initial problem shows up as a "Stack OverflowError" and later shows
as a maven-surefire-plugin problem "Error occurred in starting fork"
as shown in the following two stacks.

Please let me know if this is a known problem and how I may correct for it.
Thanks.

The first stack area shows:

[INFO] --- sonar-maven-plugin:2.0:sonar (default-cli) @ tem-ord-ors ---
[INFO] Sonar version: 3.2.1
[INFO] [15:05:44.691] Create JDBC datasource to url jdbc:mysql://met002.build.prod.services.fsglobal.net:3306/sonar?useUnicode=true&characterEncoding=utf8
[INFO] [15:05:46.806] Initializing Hibernate
[INFO] [15:05:50.814] ------------- Analyzing ORS Configuration
[INFO] [15:05:51.978] Selected quality profile : [name=SonarWayWithFindbugsForNFS,language=java]
[INFO] [15:05:52.011] Configure maven plugins...
[INFO] [15:05:52.138] Compare to previous analysis
[INFO] [15:05:52.178] Compare over 7 days (2012-09-28)
[INFO] [15:05:52.195] Compare over 14 days (2012-09-21)
[INFO] [15:05:52.528] Deleting C:\hudson\workspace\ors-metrics\tem-ord-ors-config\target\jacoco.exec
[INFO] [15:05:52.621] JaCoCo agent (version 0.5.10.201208310627) extracted: C:\Users\build\AppData\Local\Temp\jacocoagent9209031719222248810.jar
[INFO] [15:05:52.622] JVM options: -javaagent:C:\Users\build\AppData\Local\Temp\jacocoagent9209031719222248810.jar=destfile=target/jacoco.exec,excludes=*_javassist_* -Dfs.allow.elevated.helping=true -DuseLegacyLogging=true -DuseLegacyConfig=true -XX:MaxPermSize=512m -Xmx640m -javaagent:"${settings.localRepository}/org/jacoco/jacocoagent/0.5.0.20110119215959/jacocoagent-0.5.0.20110119215959.jar"=destfile="C:\hudson\workspace\ors-metrics\tem-ord-ors-config/target/jacoco.exec",append=true
[INFO] [15:05:52.658] Initializer FindbugsMavenInitializer...
[INFO] [15:05:52.659] Initializer FindbugsMavenInitializer done: 1 ms
[INFO] [15:05:52.659] Execute maven plugin maven-surefire-plugin...
[INFO] [15:05:52.659] Execute org.apache.maven.plugins:maven-surefire-plugin:2.12:test...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ORS Configuration 0.0.0.13
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-surefire-plugin:2.12:test (default-cli) @ tem-ord-ors-config ---
[INFO] Surefire report directory: C:\hudson\workspace\ors-metrics\tem-ord-ors-config\target\surefire-reports

-------------------------------------------------------
T E S T S
-------------------------------------------------------
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:323)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:338)
Caused by: java.lang.StackOverflowError
at java.lang.Long.valueOf(Long.java:554)
at org.jacoco.agent.rt_c722md.core.data.ExecutionData.$jacocoInit(ExecutionData.java)
at org.jacoco.agent.rt_c722md.core.data.ExecutionData.<init>(ExecutionData.java)
at org.jacoco.agent.rt_c722md.core.data.ExecutionDataStore.get(ExecutionDataStore.java:80)
at org.jacoco.agent.rt_c722md.core.runtime.ExecutionDataAccess.getExecutionData(ExecutionDataAccess.java:64)
at org.jacoco.agent.rt_c722md.core.runtime.ExecutionDataAccess.equals(ExecutionDataAccess.java:161)
at org.jacoco.agent.rt_c722md.core.data.ExecutionData.$jacocoInit(ExecutionData.java)
at org.jacoco.agent.rt_c722md.core.data.ExecutionData.<init>(ExecutionData.java)
at org.jacoco.agent.rt_c722md.core.data.ExecutionDataStore.get(ExecutionDataStore.java:80)
at org.jacoco.agent.rt_c722md.core.runtime.ExecutionDataAccess.getExecutionData(ExecutionDataAccess.java:64)
at org.jacoco.agent.rt_c722md.core.runtime.ExecutionDataAccess.equals(ExecutionDataAccess.java:161)
at org.jacoco.agent.rt_c722md.core.data.ExecutionData.$jacocoInit(ExecutionData.java)
at org.jacoco.agent.rt_c722md.core.data.ExecutionData.<init>(ExecutionData.java)
... This repeats over 200 times and then is followed with:
at org.jacoco.agent.rt_c722md.core.runtime.ExecutionDataAccess.getExecutionData(ExecutionDataAccess.java:64)
at org.jacoco.agent.rt_c722md.core.runtime.ExecutionDataAccess.equals(ExecutionDataAccess.java:161)
at org.jacoco.agent.rt_c722md.core.data.ExecutionData.$jacocoInit(ExecutionData.java)
at org.jacoco.agent.rt_c722md.core.data.ExecutionData.<init>(ExecutionData.java)
at org.jacoco.agent.rt_c722md.core.data.ExecutionDataStore.get(ExecutionDataStore.java:80)
FATAL ERROR in native method: processing of -javaagent failed
Exception in thread "main"

...

Then just before the end of the build we get the following stack:

[INFO] Final Memory: 29M/247M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-cli) on project tem-ord-ors-config: Error occurred in starting fork, check output in log -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-cli) on project tem-ord-ors-config: Error occurred in starting fork, check output in log
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:85)
at org.sonar.maven3.Maven3PluginExecutor.concreteExecute(Maven3PluginExecutor.java:49)
at org.sonar.batch.AbstractMavenPluginExecutor.execute(AbstractMavenPluginExecutor.java:49)
at org.sonar.batch.AbstractMavenPluginExecutor.execute(AbstractMavenPluginExecutor.java:38)
at org.sonar.batch.phases.InitializersExecutor.executeMavenPlugin(InitializersExecutor.java:73)
at org.sonar.batch.phases.InitializersExecutor.execute(InitializersExecutor.java:60)
at org.sonar.batch.phases.Phases.execute(Phases.java:90)
at org.sonar.batch.bootstrap.ProjectModule.doStart(ProjectModule.java:139)
at org.sonar.batch.bootstrap.Module.start(Module.java:83)
at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:131)
at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:126)
at org.sonar.batch.bootstrap.BatchModule.doStart(BatchModule.java:121)
at org.sonar.batch.bootstrap.Module.start(Module.java:83)
at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:121)
at org.sonar.batch.bootstrap.Module.start(Module.java:83)
at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:73)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:60)
at org.sonar.maven3.SonarMojo.execute(SonarMojo.java:142)
at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:113)
at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:65)
at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:90)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error occurred in starting fork, check output in log
at org.apache.maven.plugin.surefire.SurefirePlugin.assertNoException(SurefirePlugin.java:656)
at org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary(SurefirePlugin.java:645)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:137)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:98)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 48 more
Caused by: org.apache.maven.surefire.booter.SurefireBooterForkException: Error occurred in starting fork, check output in log
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:281)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:113)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:199)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAllProviders(AbstractSurefireMojo.java:176)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:135)
... 51 more
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project tem-ord-ors: Can not execute Sonar: Unable to execute maven plugin: Exception during execution of org.apache.maven.plugins:maven-surefire-plugin:2.12:test -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project tem-ord-ors: Can not execute Sonar
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute Sonar
at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:118)
at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:65)
at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:90)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: org.sonar.api.utils.SonarException: Unable to execute maven plugin
at org.sonar.batch.AbstractMavenPluginExecutor.execute(AbstractMavenPluginExecutor.java:51)
at org.sonar.batch.AbstractMavenPluginExecutor.execute(AbstractMavenPluginExecutor.java:38)
at org.sonar.batch.phases.InitializersExecutor.executeMavenPlugin(InitializersExecutor.java:73)
at org.sonar.batch.phases.InitializersExecutor.execute(InitializersExecutor.java:60)
at org.sonar.batch.phases.Phases.execute(Phases.java:90)
at org.sonar.batch.bootstrap.ProjectModule.doStart(ProjectModule.java:139)
at org.sonar.batch.bootstrap.Module.start(Module.java:83)
at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:131)
at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:126)
at org.sonar.batch.bootstrap.BatchModule.doStart(BatchModule.java:121)
at org.sonar.batch.bootstrap.Module.start(Module.java:83)
at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:121)
at org.sonar.batch.bootstrap.Module.start(Module.java:83)
at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:73)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:60)
at org.sonar.maven3.SonarMojo.execute(SonarMojo.java:142)
at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:113)
... 23 more
Caused by: org.sonar.api.utils.SonarException: Exception during execution of org.apache.maven.plugins:maven-surefire-plugin:2.12:test
at org.sonar.maven3.Maven3PluginExecutor.concreteExecute(Maven3PluginExecutor.java:51)
at org.sonar.batch.AbstractMavenPluginExecutor.execute(AbstractMavenPluginExecutor.java:49)
... 39 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException


Any help in resolving why this problem occurs would be very much appreciated.
Thanks.
Doug

Marc R. Hoffmann

unread,
Oct 8, 2012, 1:15:19 PM10/8/12
to jac...@googlegroups.com
Hi,

this happens if you specify two JaCoCo agent of different versions. If
you look at your log files this is obviously the case:

[INFO] [15:05:52.622] JVM options: -javaagent:... -javaagent:...

Make sure you specify only ine JaCoCo agent (preferably the newer version).

Best regards,
-marc
--
Marc Hoffmann
hoff...@mountainminds.com
_______________________________________________
Mountainminds GmbH & Co. KG

Nussbaumstr. 4 * 80336 Muenchen * Germany
Phone/Fax +49-700-68664637 * 0700-MTNMINDS

Registergericht Muenchen * HRA 80201
Mountainminds Verwaltungs GmbH
Registergericht Muenchen * HRB 143183
Geschaeftsfuehrer Marc Hoffmann

Doug Beattie

unread,
Oct 8, 2012, 1:34:00 PM10/8/12
to jac...@googlegroups.com
Thanks Marc.
I will have the team look into why this happened and correct it.
Doug

joz...@gmail.com

unread,
Feb 27, 2013, 2:32:56 PM2/27/13
to jac...@googlegroups.com
Hey Doug,
have you figured that out? I have same issue right now with jacoco 0.6.3-SNAPSHOT

If i specify agent in <argLine> for surefire it somehow defines javaagent twice and fails with StackOverFlow, if I don't specify it, jacoco doesn't see it at all and says "Skipping JaCoCo execution due to missing execution data file"

Thanks.

~
Eugene

Richard

unread,
Oct 11, 2013, 3:52:44 PM10/11/13
to jac...@googlegroups.com, joz...@gmail.com
Hi,
I'll second Eugene, I'm having the same problem as well. I was thinking it was because the version of jacoco that sonar uses is different and that was causing problems (based on this thread and https://github.com/jacoco/jacoco/issues/112). I tried adding <sonar.dynamicAnalysis>reuseResults</sonar.dynamicAnalysis> to the sonar configuration in my pom file so that it would just use the exec file from the initial run of jacoco and not try to regenerate it, but that didn't work either.

I could try reverting the jacoco-maven-plugin to 0.6.2 (which appears to be the version the sonar-maven-plugin is using), but would rather not have to do that.

Richard.

Doug Beattie

unread,
Oct 11, 2013, 3:58:10 PM10/11/13
to jac...@googlegroups.com
I haven't figured it out yet. Most of our projects analyze just fine. We have two from just under 400 prject that have the problem.
Perhaps someday we'll all get it sorted out.


--
You received this message because you are subscribed to a topic in the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jacoco/kWzps85l7Xo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Richard

unread,
Oct 15, 2013, 1:35:28 PM10/15/13
to jac...@googlegroups.com, joz...@gmail.com, richard...@gmail.com
The issue does appear to have been because of sonar using a different version of jacoco than we had defined for the jacoco-maven-plugin. However, I couldn't get it working because I was configuring it incorrectly. You do need to use the <sonar.dynamicAnalysis> property, but I was putting it in the sonar-maven-plugin configuration. It actually needs to go under the pom <properties> (same as properties like sonar.host.url or soonar.jdbc.url), so these are the properties I added that resolved the issue for me:

<properties>
...
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.junit.reportsPath>/surefire-reports</sonar.junit.reportsPath>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.jacoco.reportPath>target/jacoco.exec</sonar.jacoco.reportPath>
...
</properties>

I'm not sure if you'd actually need anything more than just the <sonar.dynamicAnalysis> property (Not sure if it would just search for the surefire reports and jacoco.exec in default locations if they're not defined or not).

Richard.

Sumit Bhawsar

unread,
Apr 27, 2016, 7:31:29 AM4/27/16
to JaCoCo and EclEmma Users
Hi Marc,

I was facing the same problem "Caused by: java.lang.StackOverflowError".

As you mentioned it was two jacoco agents 0.7.4.201502262128 and 0.7.3.201502191951, by mentioning the higher version the problem got solved.

Thanks for your help :)

Regards,
Sumit Bhawsar


Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages