JACOCO-0.7.6+Tomcat-8.0.2.3+Jenkins, Connection refused to TCP server, Unable to dump.

763 views
Skip to first unread message

Anil Satya

unread,
Aug 16, 2016, 9:59:20 AM8/16/16
to JaCoCo and EclEmma Users

I have done the required research before adding this topic. Could not find a proper match, so created new thread.

This is my Ant Dump task:

<target name="dump-now" depends="init">
                <echo message="entering dump part" />
                <jacoco:dump address="MyServer" port="6090" dump="true" destfile="${coverage.dir}/
lmjacoco.exec" retryCount="10" />        
        </target>


This is my jenkins JAVA_ARG setup:


JAVA_OPTS=-javaagent:/tools/jacoco-0.7.6/lib/jacocoagent.jar=includes=com.manh.*:com.logistics.*,destfile=/builds/v2017/lm/deployments/lm/tomcat-ora/distribution/coverage/lmjacoco.exec,output=tcpserver


My tomcat application is started on port: 26000.


The TCP port mentioned in the ant task isn't being used by any other process. The below is the error available in the jenkins console (Edited to remove actual server name and IP address):


generate-report:
     [echo] Generating xml report....

init:

dump-now:
     [echo] entering dump part
[jacoco:dump] Connecting to MyServer:6090
[jacoco:dump] Connection refused


Is there a problem with this setup. I've also tried the alternative where I give the address and TCP port in the Jenkins JAVA_OPTS itself. Please help.

Anil Satya

unread,
Aug 16, 2016, 10:02:23 AM8/16/16
to JaCoCo and EclEmma Users

 OS is RHEL 7 with OpenJDK - 8_52

Evgeny Mandrikov

unread,
Aug 17, 2016, 3:48:20 AM8/17/16
to JaCoCo and EclEmma Users
Hi,

You run agent without explicit specification of port, so that it uses default "6300" ( see http://www.eclemma.org/jacoco/trunk/doc/agent.html and http://www.eclemma.org/jacoco/trunk/doc/ant.html#coverage ), while you request dump from port "6090".

Hope this helps.
Message has been deleted

Anil Satya

unread,
Aug 18, 2016, 10:49:52 AM8/18/16
to JaCoCo and EclEmma Users
Hello Evgeny,

     Thanks a lot for the timely reply. As per your suggestion, these are now my JAVA_OPTS:

JAVA_OPTS=-javaagent:/tools/
jacoco-0.7.6/lib/jacocoagent.jar=includes=com.manh.*:com.logistics.*,destfile=/builds/v2017/lm/deployments/lm/tomcat-ora/distribution/coverage/lmjacoco.exec,output=tcpserver,port=65000

The connection refused exception is now gone, but the .exec file recieved only 5 Bytes of data and the sessions tab shows this message:

Sessions

No session information available.

No execution data available.


Also, the jenkins console had this:


dump-now:
     [echo] entering dump part
[jacoco:dump] Connecting to MyTCPServer:65000
[jacoco:dump] Dumping execution data to /builds/v2017/lm/deployments/
lm/tomcat-ora/distribution/coverage/lmjacoco.exec
[jacoco:report] Loading execution data file /builds/v2017/lm/deployments/
lm/tomcat-ora/distribution/coverage/lmjacoco.exec
[jacoco:report] Writing bundle 'Code Coverage Report from JaCoCo for LM' with 3523 classes
     [echo] /staging/2017/jenkin-slave/
vci-wmlm-17/workspace/LM_2017_CI_LJO_DAILY_DEPLOYMENT
     [copy] Copying 1 file to /staging/2017/jenkin-slave/
vci-wmlm-17/workspace/LM_2017_CI_LJO_DAILY_DEPLOYMENT
     [copy] Copying 7307 files to /staging/2017/jenkin-slave/
vci-wmlm-17/workspace/LM_2017_CI_LJO_DAILY_DEPLOYMENT


Looks like I've come very close and I'm doing some small mistake. Can you please help me out?


Evgeny Mandrikov

unread,
Aug 18, 2016, 1:40:50 PM8/18/16
to JaCoCo and EclEmma Users
Possible checklist:
  • check that server is up while dump is performed, i.e. that you don't face issue similar to https://groups.google.com/d/msg/jacoco/9UUoA28GvB8/vCPAz0E_CAAJ , JaCoCo 0.7.7 contains improvement which helps to detect such situation - https://github.com/jacoco/jacoco/pull/397
  • check that you request dump after actual execution of code/tests
  • dump Ant task has option to "reset" data, so check that you don't accidentally do a dump multiple times, where one of them performs reset
  • check that you instruct JaCoCo agent to instrument proper classes, e.g. by completely removing "includes" option, also there is an option "classdumpdir" which can be used to see which classes were instrumented
  • etc
As a general advice in investigations of problems - use "divide and conquer" principle, i.e. remove factors from equation:
  • run locally instead of Jenkins to fully see and control the process
  • try to get coverage using "file" mode before trying "tcpserver" mode
  • run commands (application start , execution/tests, dump) separately and manually instead of fully automated Ant script
  • etc

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