As said before the only situation we know when this happens is when the main method of a Java program exits with the interrupted thread status. Have you checked this?

On 24.08.17 21:45, [email protected] wrote:
On Thursday, August 24, 2017 at 9:16:18 AM UTC-5, Marc R. Hoffmann wrote:
Hi,

all JaCoCo tools will always throw an exception in truncated exec files.
The reports will be incomplete anyways.

If you're ok with an incomplete report I created a code snippet for you
which can heal the exec file for you:
https://gist.github.com/marchof/19aebb567ca4598c77b391460da39376

But please be warned: All classes that have been truncated will show as
uncovered in the coverage report. I would rather recommend to fix the
root cause.

Regards,
-marc

On 23.08.17 22:12, [email protected] wrote:
On Tuesday, August 15, 2017 at 4:08:40 PM UTC-5, suhas nvk wrote:
Hi,
We are observing the "Unable to read execution data file" error consistently 
when we run our builds on TeamCity agents that have the Linux operating system.  We 
believe the generated jacoco exec file is getting corrupted.
Can you please help us in resolving this error?

Jacoco version is 0.7.7.201606060606
Java version is  1.8.0_131
Ant version is 1.9.5

Following is the stacktrace of the error.
[jacoco:report] Loading execution data file 
/local/home/tcagent/TeamCityAgent/work/7cf8c5b5cc582291/build/tmp/pdk/jacoco/coverage/jacoco.exec
[12:22:35][jacoco:report] Unable to read execution data file 
/local/home/tcagent/TeamCityAgent/work/7cf8c5b5cc582291/build/tmp/pdk/jacoco/coverage/jacoco.exec
[12:22:35]
[antcall] The following error occurred while executing this line:
/local/home/tcagent/TeamCityAgent/work/7cf8c5b5cc582291/build/utils/buildinclude/build-quality.xml:1079:
 Unable to read execution data file 
/local/home/tcagent/TeamCityAgent/work/7cf8c5b5cc582291/build/tmp/pdk/jacoco/coverage/jacoco.exec

[12:22:35][Step 2/2] Process exited with code 1
[12:22:35][Step 2/2] Ant output
[12:22:35][Ant output]  at 
org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
[12:22:35][Ant output]  at 
org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
[12:22:35][Ant output]  at 
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
[12:22:35][Ant output]  at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown 
Source)
[12:22:35][Ant output]  at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[12:22:35][Ant output]  at java.lang.reflect.Method.invoke(Method.java:498)
[12:22:35][Ant output]  at 
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[12:22:35][Ant output]  at org.apache.tools.ant.Task.perform(Task.java:348)
[12:22:35][Ant output]  at org.apache.tools.ant.Target.execute(Target.java:435)
[12:22:35][Ant output]  at 
org.apache.tools.ant.Target.performTasks(Target.java:456)
[12:22:35][Ant output]  at 
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
[12:22:35][Ant output]  at 
org.apache.tools.ant.Project.executeTarget(Project.java:1376)
[12:22:35][Ant output]  at 
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[12:22:35][Ant output]  at 
org.apache.tools.ant.Project.executeTargets(Project.java:1260)
[12:22:35][Ant output]  at org.apache.tools.ant.Main.runBuild(Main.java:853)
[12:22:35][Ant output]  at org.apache.tools.ant.Main.startAnt(Main.java:235)
[12:22:35][Ant output]  at 
org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
[12:22:35][Ant output]  at 
org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)
[12:22:35][Ant output] Caused by: java.io.EOFException
[12:22:35][Ant output]  at 
java.io.DataInputStream.readUnsignedShort(DataInputStream.java:340)
[12:22:35][Ant output]  at 
java.io.DataInputStream.readUTF(DataInputStream.java:589)
[12:22:35][Ant output]  at 
java.io.DataInputStream.readUTF(DataInputStream.java:564)
[12:22:35][Ant output]  at 
org.jacoco.core.data.ExecutionDataReader.readExecutionData(ExecutionDataReader.java:148)
[12:22:35][Ant output]  at 
org.jacoco.core.data.ExecutionDataReader.readBlock(ExecutionDataReader.java:115)
[12:22:35][Ant output]  at 
org.jacoco.core.data.ExecutionDataReader.read(ExecutionDataReader.java:92)
[12:22:35][Ant output]  at 
org.jacoco.core.tools.ExecFileLoader.load(ExecFileLoader.java:59)
[12:22:35][Ant output]  at 
org.jacoco.ant.ReportTask.loadExecutionData(ReportTask.java:514)
[12:22:35][Ant output]  ... 121 more
[12:22:35][Ant output]

Following is the configuration for jacoco
    <target name="jacoco"
            depends="jacoco-help, jacoco-setup"
            unless="help"
            description="Turns on JaCoCo instrumentation/reporting">
      <property name="jacoco.enabled" value="true" />
      <property name="test.coverage.reporttarget" value="jacoco-generate-report" 
/>
      <path id="classpath-jacoco-runtime">
        <fileset dir="${lib.dir}">
          <include name="**/build/*jacoco*.jar" />
          <include name="**/build/asm*.jar" />
        </fileset>
      </path>
      <pathconvert property="test.coverage.runtimejars" 
refid="classpath-jacoco-runtime" />
    </target>

    <target name="jacoco-setup"
            depends="java-setup"
            unless="jacoco-setup.completed"
            xmlns:jacoco="antlib:org.jacoco.ant">
      <property name="jacoco.tmp.dir" value="${build.tmp.dir}/jacoco" />
      <property name="jacoco.coverage.dir" value="${jacoco.tmp.dir}/coverage" />
      <mkdir dir="${jacoco.coverage.dir}" />
      <property name="jacoco.reports.dir" value="${build.report.dir}/jacoco" />
      <mkdir dir="${jacoco.reports.dir}" />
      <property name="jacoco.result.file" 
value="${jacoco.coverage.dir}/jacoco.exec" />
      <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
        <classpath>
          <path refid="classpath-build"/>
        </classpath>
      </taskdef>
      <jacoco:agent property="test.coverage.jvmargs"
                    destfile="${jacoco.result.file}"
                    append="true"
                    enabled="true"
                    output="file"/>
      <property name="jacoco-setup.completed" value="true"/>
    </target>

    <target name="jacoco-generate-report"
            depends="jacoco-setup"
            if="jacoco.enabled"
            xmlns:jacoco="antlib:org.jacoco.ant">
      <jacoco:report>
        <executiondata>
          <file file="${jacoco.result.file}"/>
        </executiondata>
        <structure name="JaCoCo Report">
          <classfiles>
            <fileset dir="${java.main.classdir}"/>
          </classfiles>
          <sourcefiles encoding="UTF-8">
            <fileset dir="${java.main.src}" />
          </sourcefiles>
        </structure>
        <html destdir="${jacoco.reports.dir}" />
      </jacoco:report>
      <antcall target="report-summary">
        <param name="summary.section" value="quality"/>
        <param name="summary.entry" value="jacoco"/>
        <param name="summary.entry.url" value="jacoco/index.html"/>
        <param name="summary.entry.link" value="JaCoCo"/>
        <param name="summary.entry.text" value="JaCoCo code coverage reports."/>
      </antcall>
    </target>
I'm working on the same project; is there anyway to prevent the report task 
from running until the test output is complete?

I would rather fix the incomplete report; any suggestions on how to stop the 
JVM from exiting prematurely while writing it?


--
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/a79c5668-f29b-79e0-32a3-c227c9a06b58%40mountainminds.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to