Unable to dump from multiple jacoco java agents

58 views
Skip to first unread message

udaan...@gmail.com

unread,
Jan 24, 2020, 6:04:03 AM1/24/20
to JaCoCo and EclEmma Users
Hi,

I am trying to use the on-the-fly instrumentation on hive source code by passing jacocoagent.jar as a javaagent. Everything works fine for single javaagent but when I try to pass multiple javaagents the socket connection is only opened for the first passed javaagent. These are my final java options that i get after jps -lvm

org.apache.hadoop.util.RunJar /mnt/c/Users/admin/work/apache-hive/hive/packaging/target/apache-hive-4.0.0-SNAPSHOT-bin/apache-hive-4.0.0-SNAPSHOT-bin/lib/hive-cli-4.0.0-SNAPSHOT.jar org.apache.hadoop.hive.cli.CliDriver -Dproc_jar -Djava.net.preferIPv4Stack=true -Dproc_hivecli -javaagent:/mnt/c/Users/admin/work/apache-hive/hive/packaging/target/apache-hive-4.0.0-SNAPSHOT-bin/apache-hive-4.0.0-SNAPSHOT-bin/lib/jacocoagent.jar=output=tcpserver,port=5005,includes=org.apache.hadoop.hive.cli.* -javaagent:/mnt/c/Users/admin/work/apache-hive/hive/packaging/target/apache-hive-4.0.0-SNAPSHOT-bin/apache-hive-4.0.0-SNAPSHOT-bin/lib/jacocoagent.jar=output=tcpserver,port=5006,includes=org.apache.hadoop.hive.*,excludes=org.apache.hadoop.hive.ql.*:org.apache.hadoop.hive.cli.* -Dlog4j.configurationFile=hive-log4j2.properties -Djava.util.logging.config.file=/mnt/c/Users/admin/work/apache-hive/hive/packaging/target/apache-hive-4.0.0-SNAPSHOT-bin/apache-hive-4.0.0-SNAPSHOT-bin/conf/parquet-logging.properties -Djline.terminal=jline.UnsupportedTerminal -Dyarn.log.dir=/mnt/c/Users/admin/work/hadoop-local/hadoop/logs -Dyarn.log.file=hadoop.log -Dyarn.home.dir=/mnt/c/Users/admin/work/hadoop-local/hadoop -Dyarn.root.logger=INFO,console -Djava.librar  

As you can see I am trying to use two jacoco agents on port 5005 and 5006. I then use ExecutionDataClient Example to dump the .exec. It works only for one port, whichever is declared first. The second port says connection refused. I checked with netstat -an on command prompt and I can see only the port which was declared first is opening. Also the second jacocoagent does try to instrument the code as I receive instrumentation error if I remove the excludes option. So the jacocoagent is loaded only not able to open the port. Please can someone point me in the right direction?
Message has been deleted

Marc Hoffmann

unread,
Jan 24, 2020, 7:58:23 AM1/24/20
to jac...@googlegroups.com
Hi,

you cannot specify multiple JaCoCo agent for the same JVM.

Regards,
-marc

On 24. Jan 2020, at 13:56, Parvaz Bhaskar <udaan...@gmail.com> wrote:

Update: I've tried the same thing with a simpler project with two packages. The result is same, the port passed as second jacocoagent doesn't open.

-- 
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/263e7388-966b-4c53-9eee-3597a157e697%40googlegroups.com.

Parvaz Bhaskar

unread,
Jan 24, 2020, 8:00:28 AM1/24/20
to JaCoCo and EclEmma Users
Update: I tried the same setup with simpler project. The command to run looks like :

 java -javaagent:lib/jacocoagent.jar=output=tcpserver,port=8101,excludes=com.somepackage.* -javaagent:lib/jacocoagent.jar=output=tcpserver,port=8100,excludes=com.otherpackage.* -cp jacoco-1.0-SNAPSHOT.jar:lib/* com.somepackage
.MainClass

The behavior remains same, only first port is opened. 

On Friday, 24 January 2020 16:34:03 UTC+5:30, Parvaz Bhaskar wrote:

Parvaz Bhaskar

unread,
Jan 24, 2020, 8:08:25 AM1/24/20
to JaCoCo and EclEmma Users
Thanks Marc for the reply. I am trying to generate multiple execution files for each module, as I had trouble generating reports from a single exec file, operation ending with IllegalStateException for same name classes. I tried doing a multi-module maven setup but it didn't work for me. I have to generate coverage data without running tests or going through maven-surefire-plugin. I want to gather data off a regular JVM. What are my options here?

Thanks for the support!!
To unsubscribe from this group and stop receiving emails from it, send an email to jac...@googlegroups.com.

Marc Hoffmann

unread,
Jan 24, 2020, 10:15:13 AM1/24/20
to JaCoCo and EclEmma Users
Hi,

collect the data with a single agent for all packages.

If you have  duplicate classes in your code base create the reports separately for the modules with same class names (you can use the same exec file as input for both)

Beside Maven you can create reports with Ant or the command line. See documentation: https://www.jacoco.org/jacoco/trunk/doc/

Regards,
-marc

To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/fc0d03cc-fa7b-4cc7-8293-11481669175f%40googlegroups.com.

Parvaz Bhaskar

unread,
Jan 24, 2020, 10:24:10 AM1/24/20
to JaCoCo and EclEmma Users
Thank you for the help!
To unsubscribe from this group and stop receiving emails from it, send an email to jac...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/fc0d03cc-fa7b-4cc7-8293-11481669175f%40googlegroups.com.

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