Jacoco code coverage for a live distributed system

1,047 views
Skip to first unread message

Limou Wang

unread,
Jul 22, 2013, 3:54:16 PM7/22/13
to jac...@googlegroups.com
I was trying to do the live code coverage on a distributed system. I could not attach the jacoco agent to the JVM. I'm instrumenting the binary before deploying. However, since it's a live JVM, how could I stop it to get the correct execution data coverage. Right now, I manually stopped the jvm and when I try to generate report using jacoco.exec, it reports error while creating the report. Any help will be really appreciate.

Marc R. Hoffmann

unread,
Jul 22, 2013, 4:10:46 PM7/22/13
to jac...@googlegroups.com
Hi,

> However, since it's a live JVM, how could I
> stop it to get the correct execution data coverage.

no need to stop the JVM. JaCoCo supports remote dumps. See how you
configure JaCoCo when classes are instrumented offline:

http://www.eclemma.org/jacoco/trunk/doc/offline.html

There's an Ant task to request dumps:

http://www.eclemma.org/jacoco/trunk/doc/ant.html#dump

> Right now, I manually stopped the jvm and when I try to generate
> report using jacoco.exec, it reports error while creating the report.

What is the exact error message?

Regards,
-marc

Limou Wang

unread,
Jul 22, 2013, 4:28:03 PM7/22/13
to jac...@googlegroups.com
Hi Marc,

    Thank you for your reply.

    Since I'm not allowed to attach the Jacoco agent to the JVM. Can I still use that dump task?

    The error message is : Error while creating report when I create the report with the <jacoco:report>

Marc Hoffmann

unread,
Jul 23, 2013, 2:23:13 AM7/23/13
to jac...@googlegroups.com
> Can I still use that dump task?

Yes you can. As *documentation*
(http://www.eclemma.org/jacoco/trunk/doc/offline.html) says:

"In offline mode the JaCoCo runtime can be configured with the same
set of properties which are available for the agent"

See agent configuration options here:
http://www.eclemma.org/jacoco/trunk/doc/agent.html

So if you define a System property jacoco-agent.output=tcpserver you
can request remote dumps.

> The error message is : Error while creating report when I create the
> report with the <jacoco:report>

There should be some more lines below this message with the exception
causing the problem.

Regards,
-marc

On 2013-07-22 22:28, Limou Wang wrote:
> Hi Marc,
>
> Thank you for your reply.
>
> Since I'm not allowed to attach the Jacoco agent to the JVM. Can I
> still use that dump task?
>
> The error message is : Error while creating report when I create the
> report with the <jacoco:report>
>
> On Monday, July 22, 2013 1:10:46 PM UTC-7, Marc R. Hoffmann wrote:
>
>> Hi,
>>
>> > However, since it's a live JVM, how could I
>> > stop it to get the correct execution data coverage.
>>
>> no need to stop the JVM. JaCoCo supports remote dumps. See how you
>> configure JaCoCo when classes are instrumented offline:
>>
>> http://www.eclemma.org/jacoco/trunk/doc/offline.html [1]
>>
>> There's an Ant task to request dumps:
>>
>> http://www.eclemma.org/jacoco/trunk/doc/ant.html#dump [2]
>>
>> > Right now, I manually stopped the jvm and when I try to generate
>> > report using jacoco.exec, it reports error while creating the
>> report.
>>
>> What is the exact error message?
>>
>> Regards,
>> -marc
>>
>> On 22.07.13 21:54, Limou Wang wrote:
>>> I was trying to do the live code coverage on a distributed system.
>> I
>>> could not attach the jacoco agent to the JVM. I'm instrumenting
>> the
>>> binary before deploying. However, since it's a live JVM, how could
>> I
>>> stop it to get the correct execution data coverage. Right now, I
>>> manually stopped the jvm and when I try to generate report using
>>> jacoco.exec, it reports error while creating the report. Any help
>> will
>>> be really appreciate.
>
> --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out
> [3].
>
>
>
> Links:
> ------
> [1] http://www.eclemma.org/jacoco/trunk/doc/offline.html
> [2] http://www.eclemma.org/jacoco/trunk/doc/ant.html#dump
> [3] https://groups.google.com/groups/opt_out

Limou Wang

unread,
Jul 23, 2013, 2:57:07 PM7/23/13
to jac...@googlegroups.com
Hi Mark,

    I'm sorry to have so many questions to ask. I'm really new to this. I think I'm still confused something here :

    Right now, my task was to do the live code coverage on a distributed system. Everything is running on the server.

1. If I do the on-the-fly instrumentation which means I have to specify the following? Does this mean that using jacocoagent.jar as my java agent?
-javaagent:jacocoagent.jar=option1=value1,ect.

2. If I'm using the jacocoagent as my java agent, when I deployed my build to the server, will it automatically dump to jacoco.exec every say 3 seconds(or I can configure it to do that? How?), or it will only dump to it after the JVM stops(in my case, since it's a running server, it never stops) or I have to request it to dump?

3. Right now, I'm doing the off-line instrumentation, the thing is that, when the server is running, the jacoco.exec file is creating, but nothing was there. Only when I manually stopped the server, something was dump to jacoco.exec. but the size is only 73K something. Then I generate the report using jacoco:report with this jacoco.exec. And it reports the error: Error when creating report. Is it because I manually stopped the server which result in the JVM stopped in an abnormal situation?

Thank you so much.
Regards,
~Limou
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages