'Unknown block type 0' Issue during Jacoco report generation

1,837 views
Skip to first unread message

psk...@gmail.com

unread,
Apr 4, 2019, 3:56:11 PM4/4/19
to JaCoCo and EclEmma Users
Hi,
I am getting 'java.io.IOException: Unknown block type 0' issue during Jacoco ant build.
I tried with windows command prompt and jenkins ant build as well. Encountered same issue intermittently.

I am using following jars and versions.
jacocoagent --> 0.8.3
jacocoant --> 0.8.3
java --> 1.8
ant --> 1.10.5

Sometimes i am not getting any issues. Most of the time i am facing this issue.
If you see my first run, i got an issue. In the second run i don't find any issues.
Can you please let me know the reason of this issue. How to get out of it?

First Run:
C:\jacoco_new>ant -v report
Apache Ant(TM) version 1.10.5 compiled on July 10 2018
Trying the default build file: build.xml
Buildfile: C:\jacoco_new\build.xml
Detected Java version: 1.8 in: C:\Program Files\Java\jdk1.8.0_201\jre
Detected OS: Windows 10
parsing buildfile C:\jacoco_new\build.xml with URI = file:/C:/jacoco_new/build.xml
Project base dir set to: C:\jacoco_new
parsing buildfile jar:file:/C:/apache-ant-1.10.5/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/C:/apache-ant-1.10.5/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
parsing buildfile jar:file:/C:/jacoco_new/jacocoant.jar!/org/jacoco/ant/antlib.xml with URI = jar:file:/C:/jacoco_new/jacocoant.jar!/org/jacoco/ant/antlib.xml from a zip file
Build sequence for target(s) `report' is [report]
Complete build sequence is [report, ]

report:
[antlib:org.jacoco.ant] Could not load definitions from resource org/jacoco/ant/antlib.xml. It could not be found.
[jacoco:report] Loading execution data file C:\jacoco_new\jacoco.exec

BUILD FAILED
C:\jacoco_new\build.xml:12: Unable to read execution data file C:\jacoco_new\jacoco.exec
at org.jacoco.ant.ReportTask.loadExecutionData(ReportTask.java:516)
at org.jacoco.ant.ReportTask.execute(ReportTask.java:490)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:449)
at org.apache.tools.ant.Target.performTasks(Target.java:470)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1388)
at org.apache.tools.ant.Project.executeTarget(Project.java:1361)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:834)
at org.apache.tools.ant.Main.startAnt(Main.java:223)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)
Caused by: java.io.IOException: Unknown block type 0.
at org.jacoco.core.data.ExecutionDataReader.readBlock(ExecutionDataReader.java:118)
at org.jacoco.core.data.ExecutionDataReader.read(ExecutionDataReader.java:92)
at org.jacoco.core.tools.ExecFileLoader.load(ExecFileLoader.java:59)
at org.jacoco.ant.ReportTask.loadExecutionData(ReportTask.java:514)
... 18 more

Total time: 1 second


Second Run:
C:\jacoco_new>ant -v report
Apache Ant(TM) version 1.10.5 compiled on July 10 2018
Trying the default build file: build.xml
Buildfile: C:\jacoco_new\build.xml
Detected Java version: 1.8 in: C:\Program Files\Java\jdk1.8.0_201\jre
Detected OS: Windows 10
parsing buildfile C:\jacoco_new\build.xml with URI = file:/C:/jacoco_new/build.xml
Project base dir set to: C:\jacoco_new
parsing buildfile jar:file:/C:/apache-ant-1.10.5/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/C:/apache-ant-1.10.5/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
parsing buildfile jar:file:/C:/jacoco_new/jacocoant.jar!/org/jacoco/ant/antlib.xml with URI = jar:file:/C:/jacoco_new/jacocoant.jar!/org/jacoco/ant/antlib.xml from a zip file
Build sequence for target(s) `report' is [report]
Complete build sequence is [report, ]

report:
[antlib:org.jacoco.ant] Could not load definitions from resource org/jacoco/ant/antlib.xml. It could not be found.
[jacoco:report] Loading execution data file C:\jacoco_new\jacoco.exec
[jacoco:report] Writing bundle 'DCNM' with 1646 classes

BUILD SUCCESSFUL
Total time: 27 seconds

C:\jacoco_new>

Thanks,
Senthil

Marc Hoffmann

unread,
Apr 5, 2019, 9:47:10 AM4/5/19
to JaCoCo and EclEmma Users
Hi Senthil,

the error message means that the execution data file "C:\jacoco_new\jacoco.exec” is corrupted. It contains a unexpected 0x00 byte where a valid record header is expected instead.

How do you create this file?

Regards,
-marc
> --
> 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/0560bb65-ef9a-41c7-8af1-5ad1276bd409%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

psk...@gmail.com

unread,
Apr 6, 2019, 4:19:08 AM4/6/19
to JaCoCo and EclEmma Users
Hi Marc,
I am hooking the jacocoagent with my application server. After started the application server, will run manual testing / automated test cases. Once testing is done will stop my application server. When i stop application server, automatically class files created under jacoco and jacoco.exec get create.

If i ran 10 times, 1 time getting succeeded and 9 times fails with the above reason.
What is the reason for corruption?
How i can run successfully without any issues?
Is there any workaround / fixes?

# Used for Jacoco
JAVA_OPTS="$JAVA_OPTS -javaagent:/usr/local/taco/dcm/jacoco/jacocoagent.jar=output=file,address=*,destfile=/usr/local/taco/dcm/jacoco/jacoco.exec,append=false,includes=com.taco.dcbu.vinci.rest.services.*:com.taco.dcbu.web.client.rest.*,excludes=com.taco.taglib.*:com.taco.dcbu.sm.server.scheduler.jobs.*:com/taco/dcbu/jaxws*,classdumpdir=/usr/local/taco/dcm/jacoco/"

Thanks,
Senthil

Marc Hoffmann

unread,
Apr 6, 2019, 4:54:44 AM4/6/19
to jac...@googlegroups.com
Maybe there is some problem when you transfer the file

/usr/local/taco/dcm/jacoco/jacoco.exec

to

C:\jacoco_new\jacoco.exec

?

Please do checksums on both machines and verify that the file is the same.

Also, can you please send an example of such a broken file?
> To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/3f0f1d3d-d1fb-4c9e-8642-a1e39bee6f77%40googlegroups.com.

psk...@gmail.com

unread,
Apr 6, 2019, 4:50:47 PM4/6/19
to JaCoCo and EclEmma Users
Hi Marc,
I verified checksum. That looks good.
How can i send / upload the jacoco.exec file to you ?

Thanks,
Senthil

Marc Hoffmann

unread,
Apr 6, 2019, 5:19:26 PM4/6/19
to jac...@googlegroups.com
Attachement to personal email.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/5c811a53-9959-4a95-bfc2-dbd7543de015%40googlegroups.com.

Senthil Kumar

unread,
Apr 6, 2019, 7:21:53 PM4/6/19
to jac...@googlegroups.com
Hi Marc,
Please find the jacoco.exec.

Also i tried to generate the report directly from linux machine where the jacoco.exe get generated.
I got the same issue 'Caused by: java.io.IOException: Unknown block type 0.'.

Thanks,
Senthil

You received this message because you are subscribed to a topic in the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jacoco/TsrCmG4FjUo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/3807CF3D-8891-4E21-9C78-1B30FE8E341A%40mountainminds.com.
jacoco.exec

Marc Hoffmann

unread,
Apr 7, 2019, 5:12:33 PM4/7/19
to jac...@googlegroups.com
Hi Senthil,

indeed this is a invalid exec file. You can check with our command line tool and will get the same error message:

$ java -jar jacococli.jar execinfo jacoco.exec

Wenn looking at the binary content of the file with hexdump there are major sections which are filled with zeros (see below). I have no idea why the file isn’t written properly or gets corrupted afterwards. And I can’t remember that we had reports like this before. You might check the underlying file system.

Regards,
-marc




$ hexdump -C jacoco.exec
00000000  01 c0 c0 10 07 10 00 20  64 63 6e 6d 31 31 31 31  |....... dcnm1111|
00000010  76 6d 32 31 33 2e 63 69  73 63 6f 2e 63 6f 6d 2d  |vm213.cisco.com-|
00000020  31 38 30 32 39 64 62 65  00 00 01 69 f4 2f a1 30  |18029dbe...i./.0|
00000030  00 00 01 69 f4 2f a5 ff  00 00 00 00 00 00 00 00  |...i./..........|
00000040  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000af0  00 00 00 00 00 00 ae 2b  11 4d b7 b5 61 d2 7c 20  |.......+.M..a.| |
00000b00  8c 00 2e 63 6f 6d 2f 63  69 73 63 6f 2f 64 63 62  |...com/cisco/dcb|
00000b10  75 2f 76 69 6e 63 69 2f  72 65 73 74 2f 73 65 72  |u/vinci/rest/ser|
00000b20  76 69 63 65 73 2f 51 75  65 72 79 4f 62 6a 65 63  |vices/QueryObjec|
00000b30  74 20 01 00 00 8e 11 d0  eb 14 30 4b 6e 74 53 00  |t ........0KntS.|
00000b40  35 63 6f 6d 2f 63 69 73  63 6f 2f 64 63 62 75 2f  |5com/cisco/dcbu/|
00000b50  76 69 6e 63 69 2f 72 65  73 74 2f 73 65 72 76 69  |vinci/rest/servi|
00000b60  63 65 73 2f 63 6f 6e 66  69 67 2f 43 43 52 75 6e  |ces/config/CCRun|
00000b70  44 65 74 61 69 6c 09 d7  01 11 80 45 56 18 fd 7f  |Detail.....EV...|
00000b80  fb 45 00 39 63 6f 6d 2f  63 69 73 63 6f 2f 64 63  |.E.9com/cisco/dc|
00000b90  62 75 2f 77 65 62 2f 63  6c 69 65 6e 74 2f 72 65  |bu/web/client/re|
00000ba0  73 74 2f 73 65 63 75 72  69 74 79 2f 41 70 70 54  |st/security/AppT|
00000bb0  6f 6b 65 6e 56 61 6c 69  64 61 74 6f 72 1c 6c 4d  |okenValidator.lM|
00000bc0  07 0c 11 b1 e4 50 88 3f  11 6b 54 00 35 63 6f 6d  |.....P.?.kT.5com|
00000bd0  2f 63 69 73 63 6f 2f 64  63 62 75 2f 76 69 6e 63  |/cisco/dcbu/vinc|
00000be0  69 2f 72 65 73 74 2f 73  65 72 76 69 63 65 73 2f  |i/rest/services/|
00000bf0  63 6f 6e 66 69 67 2f 42  61 63 6b 75 70 4a 6f 62  |config/BackupJob|
00000c00  44 4f 11 01 10 00 11 6d  31 af 03 6e cd f0 d5 00  |DO.....m1..n....|
00000c10  5d 63 6f 6d 2f 63 69 73  63 6f 2f 64 63 62 75 2f  |]com/cisco/dcbu/|
00000c20  76 69 6e 63 69 2f 72 65  73 74 2f 73 65 72 76 69  |vinci/rest/servi|
00000c30  63 65 73 2f 63 6f 6e 74  72 6f 6c 2f 43 74 72 6c  |ces/control/Ctrl|
00000c40  50 6f 6c 69 63 79 4d 61  6e 61 67 65 72 53 65 72  |PolicyManagerSer|
00000c50  76 69 63 65 24 50 72 6f  78 79 24 5f 24 24 5f 57  |vice$Proxy$_$$_W|
00000c60  65 6c 64 43 6c 69 65 6e  74 50 72 6f 78 79 bf 01  |eldClientProxy..|
00000c70  00 00 00 00 80 00 00 00  00 00 00 00 45 00 00 00  |............E...|
00000c80  20 00 00 00 00 00 00 40  11 62 27 bf 65 40 56 49  | ......@.b'.e@VI|
00000c90  bb 00 2b 63 6f 6d 2f 63  69 73 63 6f 2f 64 63 62  |..+com/cisco/dcb|
00000ca0  75 2f 77 65 62 2f 63 6c  69 65 6e 74 2f 72 65 73  |u/web/client/res|
00000cb0  74 2f 53 65 63 75 72 69  74 79 52 65 73 74 2e cf  |t/SecurityRest..|
00000cc0  cf 0e 00 40 03 11 34 83  be 8e a0 8c d6 30 00 43  |...@..4......0.C|
00000cd0  63 6f 6d 2f 63 69 73 63  6f 2f 64 63 62 75 2f 76  |com/cisco/dcbu/v|
00000ce0  69 6e 63 69 2f 72 65 73  74 2f 73 65 72 76 69 63  |inci/rest/servic|
00000cf0  65 73 2f 69 6e 74 65 72  63 65 70 74 6f 72 73 2f  |es/interceptors/|
00000d00  53 65 63 75 72 69 74 79  49 6e 74 65 72 63 65 70  |SecurityIntercep|
00000d10  74 6f 72 74 4f 40 08 67  00 c7 18 96 20 00 3a a8  |tortO@.g.... .:.|
00000d20  b7 86 0f 11 43 96 0c 23  52 64 24 60 00 2c 63 6f  |....C..#Rd$`.,co|
00000d30  6d 2f 63 69 73 63 6f 2f  64 63 62 75 2f 77 65 62  |m/cisco/dcbu/web|
00000d40  2f 63 6c 69 65 6e 74 2f  72 65 73 74 2f 49 6e 76  |/client/rest/Inv|
00000d50  65 6e 74 6f 72 79 52 65  73 74 c7 0a 0f 7c 44 04  |entoryRest...|D.|
00000d60  07 7f 02 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000d70  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000e00  00 00 00 00 40 11 ed 55  3f 30 da e5 ff 74 00 28  |....@..U?0...t.(|
00000e10  63 6f 6d 2f 63 69 73 63  6f 2f 64 63 62 75 2f 77  |com/cisco/dcbu/w|
00000e20  65 62 2f 63 6c 69 65 6e  74 2f 72 65 73 74 2f 41  |eb/client/rest/A|
00000e30  62 6f 75 74 52 65 73 74  47 00 00 00 00 00 1c 00  |boutRestG.......|
00000e40  00 40 11 ac 5c 39 04 3f  35 d6 d8 00 38 63 6f 6d  |.@..\9.?5...8com|
00000e50  2f 63 69 73 63 6f 2f 64  63 62 75 2f 76 69 6e 63  |/cisco/dcbu/vinc|
00000e60  69 2f 72 65 73 74 2f 73  65 72 76 69 63 65 73 2f  |i/rest/services/|
00000e70  63 6f 6e 66 69 67 2f 42  61 63 6b 75 70 46 69 6c  |config/BackupFil|
00000e80  65 55 74 69 6c ae 01 39  00 00 00 00 00 00 00 00  |eUtil..9........|
00000e90  00 00 00 00 00 00 00 00  00 00 00 00 3c 11 05 2d  |............<..-|
00000ea0  59 77 46 6a 58 86 00 3b  63 6f 6d 2f 63 69 73 63  |YwFjX..;com/cisc|
00000eb0  6f 2f 64 63 62 75 2f 77  65 62 2f 63 6c 69 65 6e  |o/dcbu/web/clien|
00000ec0  74 2f 72 65 73 74 2f 63  6f 6e 66 69 67 2f 43 6f  |t/rest/config/Co|
00000ed0  6e 66 69 67 54 65 6d 70  6c 61 74 65 53 65 72 76  |nfigTemplateServ|
00000ee0  69 63 65 a8 05 01 00 00  00 00 00 00 00 00 00 00  |ice.............|
00000ef0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000f20  00 00 00 00 00 00 00 00  00 00 00 00 01 00 00 00  |................|
00000f30  00 00 00 00 00 00 00 00  00 80 11 e5 cb a0 a7 81  |................|
00000f40  3f 43 e4 00 45 63 6f 6d  2f 63 69 73 63 6f 2f 64  |?C..Ecom/cisco/d|
00000f50  63 62 75 2f 76 69 6e 63  69 2f 72 65 73 74 2f 73  |cbu/vinci/rest/s|
00000f60  65 72 76 69 63 65 73 2f  63 6f 6e 74 72 6f 6c 2f  |ervices/control/|
00000f70  43 74 72 6c 50 6f 6c 69  63 79 4d 61 6e 61 67 65  |CtrlPolicyManage|
00000f80  72 53 65 72 76 69 63 65  24 31 06 01 11 51 43 3e  |rService$1...QC>|
00000f90  3d 86 ca c6 0c 00 3f 63  6f 6d 2f 63 69 73 63 6f  |=.....?com/cisco|
00000fa0  2f 64 63 62 75 2f 76 69  6e 63 69 2f 72 65 73 74  |/dcbu/vinci/rest|
00000fb0  2f 73 65 72 76 69 63 65  73 2f 63 6f 6e 66 69 67  |/services/config|
00000fc0  2f 43 43 52 75 6e 44 65  74 61 69 6c 24 43 43 52  |/CCRunDetail$CCR|
00000fd0  75 6e 54 79 70 65 04 0d  11 78 02 c6 06 0d 3a d6  |unType...x....:.|
00000fe0  02 00 35 63 6f 6d 2f 63  69 73 63 6f 2f 64 63 62  |..5com/cisco/dcb|
00000ff0  75 2f 77 65 62 2f 63 6c  69 65 6e 74 2f 72 65 73  |u/web/client/res|
00001000  74 2f 6c 6f 67 67 69 6e  67 2f 4c 6f 67 49 6e 74  |t/logging/LogInt|
00001010  65 72 63 65 70 74 6f 72  39 fd 69 3f bc e7 77 c0  |erceptor9.i?..w.|
00001020  01 11 82 ec 8d cd 48 64  4a 39 00 3c 63 6f 6d 2f  |......HdJ9.<com/|
00001030  63 69 73 63 6f 2f 64 63  62 75 2f 77 65 62 2f 63  |cisco/dcbu/web/c|
00001040  6c 69 65 6e 74 2f 72 65  73 74 2f 73 65 63 75 72  |lient/rest/secur|
00001050  69 74 79 2f 54 6f 6b 65  6e 43 61 63 68 65 24 43  |ity/TokenCache$C|
00001060  61 63 68 65 54 61 73 6b  15 ff fb 17 11 b1 93 c8  |acheTask........|
00001070  df b5 ea 16 99 00 32 63  6f 6d 2f 63 69 73 63 6f  |......2com/cisco|
00001080  2f 64 63 62 75 2f 76 69  6e 63 69 2f 72 65 73 74  |/dcbu/vinci/rest|
00001090  2f 73 65 72 76 69 63 65  73 2f 47 65 6e 65 72 61  |/services/Genera|
000010a0  6c 53 65 74 74 69 6e 67  73 3c 47 00 00 00 00 00  |lSettings<G.....|
000010b0  00 00 11 28 cf c5 73 97  f7 0b f4 00 5d 63 6f 6d  |...(..s.....]com|
000010c0  2f 63 69 73 63 6f 2f 64  63 62 75 2f 76 69 6e 63  |/cisco/dcbu/vinc|
000010d0  69 2f 72 65 73 74 2f 73  65 72 76 69 63 65 73 2f  |i/rest/services/|
000010e0  63 6f 6e 74 72 6f 6c 2f  43 74 72 6c 53 74 61 74  |control/CtrlStat|
000010f0  75 73 4d 61 6e 61 67 65  72 53 65 72 76 69 63 65  |usManagerService|
00001100  24 50 72 6f 78 79 24 5f  24 24 5f 57 65 6c 64 43  |$Proxy$_$$_WeldC|
00001110  6c 69 65 6e 74 50 72 6f  78 79 41 00 28 02 00 00  |lientProxyA.(...|
00001120  00 8a 00 00                                       |....|
00001124




For more options, visit https://groups.google.com/d/optout.
<jacoco.exec>

Senthil Kumar

unread,
Apr 8, 2019, 2:12:49 PM4/8/19
to jac...@googlegroups.com
Hi Marc,
How i can avoid this issue? 
Is this happening due to any specific file/class? if so i can exclude it from the coverage analysis?.
Can you please guide me to get out of this issue?

Thanks,
Senthil

Marc Hoffmann

unread,
Apr 10, 2019, 11:54:28 AM4/10/19
to jac...@googlegroups.com
Hi Senthil,

this is not related to a specific class. This is probably related to the lifecycle of your application and the underlying file system. Can you please give a detailed description how your setup looks like? Where and how exactly do you start the application? How do you trigger the execution data dump? How do you shutdown the application?

Regards,
-marc



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