visitSessionInfo method wasn't called from ExecutionDataServer class in a kubernetes env

43 views
Skip to first unread message

Jennie

unread,
Aug 10, 2020, 11:14:03 AM8/10/20
to JaCoCo and EclEmma Users
Hello,

I have been using Jacoco for code coverage for both unit and integration test in the past. My env for integration test by then is pure docker image and it has been working great (using both tcpclient and destfile approaches). However, I encountered problems when I switched to kubernetes env, there, with tcpclient jvm option, I observed that .exec file (zero size) was created during the pod startup, then I ran the test, after that I used kubectl scale to shutdown the pod/container, .exec data wasn't flushed (from ExecutionDataServer), I also tried to kubectl exec to the container and issued kill command there to terminate the container's jvm, still no .exec flushed. One thing I noticed is that with docker env, visitSessionInfo method was called before flushing the data, however, this method was never get called for a container in a  kubernetes env.

I'm not sure what additional info you prefer me to provide as this time, but I would happy to provide any info needed in order to investigate.

Thanks!

Evgeny Mandrikov

unread,
Aug 10, 2020, 11:29:28 AM8/10/20
to JaCoCo and EclEmma Users
Hi,

This has been answered an enormous amount of times - please use search. For example
etc.

For execution of shutdown hooks JVM must be terminated gracefully, i.e. not killed.

Regards,
Evgeny

Jennie

unread,
Aug 10, 2020, 11:43:01 AM8/10/20
to JaCoCo and EclEmma Users
Thanks for your reply. kubectl scale deployment mypod -replicas=0 should be the way to gracefully shutdown the pod/container but it does't flush the .exec data either. I will re-read some of provided links here

Evgeny Mandrikov

unread,
Aug 10, 2020, 11:56:29 AM8/10/20
to JaCoCo and EclEmma Users
According to Google search, e.g.
kubectl scale
alone doesn't provide out of the box graceful shutdown for applications inside pod.

Instead of relying on JVM shutdown hook execution, you can explicitly send dump command to JaCoCo agent prior to shutdown.

Jennie

unread,
Aug 10, 2020, 12:25:13 PM8/10/20
to JaCoCo and EclEmma Users
Thanks again for your prompt reply! yes, on the fly dump seems work for me, but I have to dump the data periodically like this post: https://stackoverflow.com/questions/60474349/remotely-triggering-a-jacoco-execution-data-dump-using-jacoco-agent

The problem is, my whole automation is: start tcpserver for jacoco, start pod/container, run the test, (ideally) dump the data now. so I haven't figured out how periodically dump the .exec file  works in this automation process.

I have also considered using output=tcpserver option, but again, it will require lots of host/container port mapping before hand for all the containers in K8 for code coverage......
Reply all
Reply to author
Forward
0 new messages