agent library failed to init: instrument

5,059 views
Skip to first unread message

mpc755

unread,
Jun 20, 2013, 4:50:57 PM6/20/13
to jac...@googlegroups.com
I keep getting the following trying to get unit test code coverage:

[INFO] [16:06:37.541] JaCoCo agent (version 0.6.2.201302030002) extracted: /tmp/jacocoagent3713827830445582447.jar
[INFO] [16:06:37.541] JVM options: -javaagent:/tmp/jacocoagent3713827830445582447.jar=destfile=target/jacoco.exec,excludes=*_javassist_* -Xmx4G -XX:MaxPermSize=1G -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:-UseGCOverheadLimit

Error occurred during initialization of VM
Error opening zip file or JAR manifest missing : /tmp/jacocoagent3713827830445582447.jar
agent library failed to init: instrument

Any ideas?

Thanks.

mpc755

unread,
Jun 20, 2013, 6:46:56 PM6/20/13
to jac...@googlegroups.com
I'm guessing a /tmp/jacocoagent3713827830445582447.jar gets deleted by one test case after it was created by the next test case. The jar should be uniquely named for each test case.

Marc R. Hoffmann

unread,
Jun 21, 2013, 1:40:59 AM6/21/13
to jac...@googlegroups.com
Is this a Ant or Maven build?

Can you please provide the build script or a small reproducer?

Thanks,
-marc

mpc755

unread,
Jun 21, 2013, 2:25:04 PM6/21/13
to jac...@googlegroups.com
Hi Marc,

It's maven.

I was doing the following:

mvn clean install -DskipTests
mvn sonar:sonar

I'm able to get around the issue by doing the following:

mvn clean install -Djavaagent="-javaagent:/var/lib/jenkins/jacoco/lib/jacocoagent.jar=destfile=target/jacoco.exec,excludes=*_javassist_*" -Dmaven.test.failure.ignore=true

Where pom.xml is modified to:

  <properties>
    <javaagent></javaagent> <!-- defined on 'mvn clean install' command for code coverage -->
  </properties>

        <artifactId>maven-surefire-plugin</artifactId>
        ...
        <argLine>${javaagent}</argLine>


mvn sonar:sonar -Dsonar.dynamicAnalysis=reuseReports

Thanks for the response.

Mike

mpc755

unread,
Jun 21, 2013, 2:32:06 PM6/21/13
to jac...@googlegroups.com
The issue occurred when one test case exited abnormally. This is after 100s of tests passed. Once the issue occurred it took out the rest of the tests. They all got the same error. Only way I can think to reproduce the issue is to have a bunch of test cases executing sequentially where some get "kill -9" and other abnormal terminations. If all the unit tests are using the same "/tmp/jacocoagent3713827830445582447.jar" then the jar is probably getting corrupted somehow. If each unit test creates the same "/tmp/jacocoagent3713827830445582447.jar" then the file should be uniquely named for each test case.

Mike

Marc R. Hoffmann

unread,
Jun 21, 2013, 5:17:28 PM6/21/13
to jac...@googlegroups.com
> I was doing the following:
>
> mvn clean install -DskipTests
> mvn sonar:sonar

And the problems happens at mvn sonar:sonar? In this case please report
this issue directly at Sonar. The Sonar plug-in is not maintained here
by the JaCoCo project.

JaCoCo's prepare-agent goal does not work with tmp files, it directly
references the agent as a Maven artifact in the local repo.

Best regards,
-marc


On 21.06.13 20:25, mpc755 wrote:
> Hi Marc,
>
> It's maven.
>
> I was doing the following:
>
> mvn clean install -DskipTests
> mvn sonar:sonar
>
> I'm able to get around the issue by doing the following:
>
> mvn clean
> install -Djavaagent="-javaagent:/var/lib/jenkins/jacoco/lib/jacocoagent.jar=destfile=target/jacoco.exec,excludes=*_javassist_*"
> -Dmaven.test.failure.ignore=true
>
> Where pom.xml is modified to:
>
> <properties>
> <javaagent></javaagent> <!-- defined on 'mvn clean install' command
> for code coverage -->
> </properties>
>
> <artifactId>maven-surefire-plugin</artifactId>
> ...
> <argLine>${javaagent}</argLine>
>
>
> mvn sonar:sonar *-Dsonar.dynamicAnalysis=reuseReports*
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages