Kotlin / kotlinx-kover

Apache License 2.0
1.28k stars 48 forks source link

`koverMergedHtmlReport` fails on Windows #146

Closed JavierSegoviaCordoba closed 1 year ago

JavierSegoviaCordoba commented 2 years ago

Run: https://github.com/JavierSegoviaCordoba/mokoki/runs/5340224331

It is passing on Linux.

> Task :koverMergedHtmlReport FAILED
Error: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 69 out of bounds for length 68
    at jetbrains.coverage.report.idea.IDEACoverageClassInfo.getStatementStats(IDEACoverageClassInfo.java:129)
    at jetbrains.coverage.report.impl.StatisticsCalculatorImpl.computeForClass(StatisticsCalculatorImpl.java:51)
    at jetbrains.coverage.report.impl.StatisticsCalculatorImpl.doCompute(StatisticsCalculatorImpl.java:40)
    at jetbrains.coverage.report.impl.StatisticsCalculatorImpl.compute(StatisticsCalculatorImpl.java:34)
    at jetbrains.coverage.report.impl.html.HTMLReportBuilderImpl.generateReport(HTMLReportBuilderImpl.java:80)
    at jetbrains.coverage.report.impl.html.HTMLReportBuilderImpl.generateReport(HTMLReportBuilderImpl.java:76)
    at com.intellij.rt.coverage.report.Reporter.createHTMLReport(Reporter.java:53)
    at com.intellij.rt.coverage.report.Main.main(Main.java:48)
hadia commented 2 years ago

I have the same issue on mac

stephanepechard commented 2 years ago

Same here on a Mac too, I had to get back on version 0.5.0-RC2 to make build properly.

shanshin commented 2 years ago

Hi, sorry for the delay, did you specify a custom version of the intellij engine? @JavierSegoviaCordoba, could you provide your binary files of the report (files /build/kover/*.ic) from Windows for analysis?

JavierSegoviaCordoba commented 2 years ago

Don't worry @shanshin, I am using the default one provided by Kover 0.5.0. I can't access them because they are on CI. I will try to get them in my local machine.

shanshin commented 2 years ago

Thanks, it will be very helpful!

TiwariPankaj commented 2 years ago

hi @shanshin any update on this thread getting same error on mac. Log---

Task :android-sdk:koverHtmlReport FAILED Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 7 out of bounds for length 7 at jetbrains.coverage.report.idea.IDEACoverageClassInfo.getStatementStats(IDEACoverageClassInfo.java:129) at jetbrains.coverage.report.impl.StatisticsCalculatorImpl.computeForClass(StatisticsCalculatorImpl.java:51) at jetbrains.coverage.report.impl.StatisticsCalculatorImpl.doCompute(StatisticsCalculatorImpl.java:40) at jetbrains.coverage.report.impl.StatisticsCalculatorImpl.compute(StatisticsCalculatorImpl.java:34) at jetbrains.coverage.report.impl.html.HTMLReportBuilderImpl.generateReport(HTMLReportBuilderImpl.java:80) at jetbrains.coverage.report.impl.html.HTMLReportBuilderImpl.generateReport(HTMLReportBuilderImpl.java:76) at com.intellij.rt.coverage.report.Reporter.createHTMLReport(Reporter.java:53) at com.intellij.rt.coverage.report.Main.main(Main.java:48)

FAILURE: Build failed with an exception.

JavierSegoviaCordoba commented 2 years ago

I tried to reproduce in my local machine but there it is working. @TiwariPankaj can you share what @shanshin needs? If not I have to setup the CI to save those files and it will take me some weeks.

TiwariPankaj commented 2 years ago

@JavierSegoviaCordoba can you share any secure method to share binary, or do you want me to upload here?

JavierSegoviaCordoba commented 2 years ago

If your project is open source you can share it here, if not I am not sure if you can be leaking private things.

shanshin commented 2 years ago

@TiwariPankaj hi, we could not reproduce the problem on our local machines, so binary reports from problematic builds would be very useful. If you have an open source project or you can create a small reproducer, then you can publish binary reports for it - they contain information about all classes called inside the JVM, not just the classes of the project.

darylcrypto commented 2 years ago

i faced the same issue. So far don't know the root cause unable to reproduce on macbook (os 12.0.1) problematic CI image: cimg/android:2022.01.1

QiBaobin commented 2 years ago

Same here. on both local mackbook (12.3) and piepline (ubuntu).

goncalossilva commented 2 years ago

I'm facing the same issue on Doist/ffs:

> Task :koverMergedHtmlReport FAILED
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 33 out of bounds for length 25
    at jetbrains.coverage.report.idea.IDEACoverageClassInfo.getStatementStats(IDEACoverageClassInfo.java:129)
    at jetbrains.coverage.report.impl.StatisticsCalculatorImpl.computeForClass(StatisticsCalculatorImpl.java:51)
    at jetbrains.coverage.report.impl.StatisticsCalculatorImpl.doCompute(StatisticsCalculatorImpl.java:40)
    at jetbrains.coverage.report.impl.StatisticsCalculatorImpl.compute(StatisticsCalculatorImpl.java:34)
    at jetbrains.coverage.report.impl.html.HTMLReportBuilderImpl.generateReport(HTMLReportBuilderImpl.java:80)
    at jetbrains.coverage.report.impl.html.HTMLReportBuilderImpl.generateReport(HTMLReportBuilderImpl.java:76)
    at com.intellij.rt.coverage.report.Reporter.createHTMLReport(Reporter.java:53)
    at com.intellij.rt.coverage.report.Main.main(Main.java:48)

Here are the binary files:

ffs.zip

overfullstack commented 2 years ago

Same issue on my Mac

[2022.04.30 14:22:30] (Coverage): Failed to process unloaded class: org.revcloud.vader.specs.specs.Spec4$Spec4Builder, error: Index 145 out of bounds for length 117
java.lang.ArrayIndexOutOfBoundsException: Index 145 out of bounds for length 117
    at org.jetbrains.coverage.org.objectweb.asm.ClassReader.readLabel(ClassReader.java:2644)
    at org.jetbrains.coverage.org.objectweb.asm.ClassReader.createLabel(ClassReader.java:2660)
    at org.jetbrains.coverage.org.objectweb.asm.ClassReader.createLabel(ClassReader.java:2671)
    at org.jetbrains.coverage.org.objectweb.asm.ClassReader.readTypeAnnotations(ClassReader.java:2738)
    at org.jetbrains.coverage.org.objectweb.asm.ClassReader.readCode(ClassReader.java:1902)
    at org.jetbrains.coverage.org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1482)
    at org.jetbrains.coverage.org.objectweb.asm.ClassReader.accept(ClassReader.java:712)
    at org.jetbrains.coverage.org.objectweb.asm.ClassReader.accept(ClassReader.java:395)
    at com.intellij.rt.coverage.instrumentation.SaveHook.appendUnloadedClass(SaveHook.java:318)
    at com.intellij.rt.coverage.instrumentation.SaveHook$5.consume(SaveHook.java:299)
    at com.intellij.rt.coverage.util.classFinder.ClassPathEntry$DirectoryEntryProcessor.collectClasses(ClassPathEntry.java:110)
    at com.intellij.rt.coverage.util.classFinder.ClassPathEntry$DirectoryEntryProcessor.collectClasses(ClassPathEntry.java:122)
    at com.intellij.rt.coverage.util.classFinder.ClassPathEntry$DirectoryEntryProcessor.collectClasses(ClassPathEntry.java:122)
    at com.intellij.rt.coverage.util.classFinder.ClassPathEntry$DirectoryEntryProcessor.collectClasses(ClassPathEntry.java:122)
    at com.intellij.rt.coverage.util.classFinder.ClassPathEntry$DirectoryEntryProcessor.collectClasses(ClassPathEntry.java:122)
    at com.intellij.rt.coverage.util.classFinder.ClassPathEntry$DirectoryEntryProcessor.collectClasses(ClassPathEntry.java:122)
    at com.intellij.rt.coverage.util.classFinder.ClassPathEntry$DirectoryEntryProcessor.iterateMatchedClasses(ClassPathEntry.java:96)
    at com.intellij.rt.coverage.util.classFinder.ClassPathEntry.iterateMatchedClasses(ClassPathEntry.java:47)
    at com.intellij.rt.coverage.util.classFinder.ClassFinder.iterateMatchedClasses(ClassFinder.java:60)
    at com.intellij.rt.coverage.instrumentation.SaveHook.appendUnloadedFullAnalysis(SaveHook.java:292)
    at com.intellij.rt.coverage.report.data.ProjectReport.collectCoverageInformationFromOutputs(ProjectReport.java:70)
    at com.intellij.rt.coverage.report.data.ProjectReport.getProjectData(ProjectReport.java:48)
    at com.intellij.rt.coverage.report.Reporter.createXMLReport(Reporter.java:41)
    at com.intellij.rt.coverage.report.Main.main(Main.java:37)

Here is my project: https://github.com/overfullstack/vader-root

darylcrypto commented 2 years ago

i faced the same issue. So far don't know the root cause unable to reproduce on macbook (os 12.0.1) problematic CI image: cimg/android:2022.01.1

i have been fixed my problem. the main reason for this problem from me is that i have multiple files with same package name (due to package rename but getting confused after many PR conflicts)

zuevmaxim commented 1 year ago

@goncalossilva I have successfully reproduced the issue with your project, thanks! Could you please try running test with kover with the latest IJCoverage agent, the issue must be solved there (it works for me). Just add to the build.gradle:

kover {
    intellijEngineVersion.set("1.0.674")
}
shanshin commented 1 year ago

Fixed in 0.6.0, feel free to reopen if the problem reproduced again.