Flank / flank

:speedboat: Massively parallel Android and iOS test runner for Firebase Test Lab
https://firebase.community/
Apache License 2.0
672 stars 113 forks source link

java.nio.BufferUnderflowException when running Flank for Android with Espresso 3.4.0 with compilSdkVersion 31 #2203

Closed dmitry-ryadnenko-izettle closed 2 years ago

dmitry-ryadnenko-izettle commented 2 years ago

When running flank firebase test android run --config my.config.file.yml. Works with project compiled with API level 30 and Espresso 3.3.0. Fails when project has API level 31 and Espresso 3.4.0. And it looks like it happens only with obfuscated code. Is this known? Flank v21.11.0.

Error

RunTests
java.nio.BufferUnderflowException
    at java.base/java.nio.Buffer.nextGetIndex(Buffer.java:707)
    at java.base/java.nio.HeapByteBuffer.getInt(HeapByteBuffer.java:435)
    at com.linkedin.dex.spec.AnnotationOffItem.<init>(AnnotationOffItem.kt:13)
    at com.linkedin.dex.spec.AnnotationSetItem$Companion.create(AnnotationSetItem.kt:18)
    at com.linkedin.dex.parser.AnnotationUtilsKt.checkIfAnnotationIsInherited(AnnotationUtils.kt:89)
    at com.linkedin.dex.parser.AnnotationUtilsKt.getTestAnnotation(AnnotationUtils.kt:77)
    at com.linkedin.dex.parser.AnnotationUtilsKt.getClassAnnotationValues(AnnotationUtils.kt:46)
    at ftl.run.platform.android.CreateAndroidTestContextKt.isParametrizedClass(CreateAndroidTestContext.kt:210)
    at ftl.run.platform.android.CreateAndroidTestContextKt.getParametrizedClasses(CreateAndroidTestContext.kt:200)
    at ftl.run.platform.android.CreateAndroidTestContextKt.getFlankTestMethods(CreateAndroidTestContext.kt:153)
    at ftl.run.platform.android.CreateAndroidTestContextKt.calculateShardsNormally(CreateAndroidTestContext.kt:86)
    at ftl.run.platform.android.CreateAndroidTestContextKt.calculateShards(CreateAndroidTestContext.kt:112)
    at ftl.run.platform.android.CreateAndroidTestContextKt.access$calculateShards(CreateAndroidTestContext.kt:1)
    at ftl.run.platform.android.CreateAndroidTestContextKt$setupShards$2$1$1.invokeSuspend(CreateAndroidTestContext.kt:49)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274)
    at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
    at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
    at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
    at ftl.presentation.RunStateKt.runBlockingWithObservingRunState(RunState.kt:17)
    at ftl.domain.RunTestAndroidKt.invoke(RunTestAndroid.kt:63)
    at ftl.presentation.cli.firebase.test.android.AndroidRunCommand.run(AndroidRunCommand.kt:58)
    at picocli.CommandLine.executeUserObject(CommandLine.java:1939)
    at picocli.CommandLine.access$1300(CommandLine.java:145)
    at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2352)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2314)
    at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
    at picocli.CommandLine$RunLast.execute(CommandLine.java:2316)
    at picocli.CommandLine.execute(CommandLine.java:2078)
    at ftl.Main$main$1.invoke(Main.kt:12)
    at ftl.Main$main$1.invoke(Main.kt:10)
    at ftl.run.exception.ExceptionHandlerKt.withGlobalExceptionHandling(ExceptionHandler.kt:28)
    at ftl.run.exception.ExceptionHandlerKt.withGlobalExceptionHandling(ExceptionHandler.kt:17)
    at ftl.Main.main(Main.kt:10)

Total run duration: 0m  5s
    - Preparation: 0m 4s
bootstraponline commented 2 years ago

@dmitry-ryadnenko-izettle Hey, please report this issue upstream to LinkedIn. https://github.com/linkedin/dex-test-parser/issues

dmitry-ryadnenko-izettle commented 2 years ago

Ok, it looks like there is already an issue with this reported there https://github.com/linkedin/dex-test-parser/issues/70.

dmitry-ryadnenko-izettle commented 2 years ago

That one was closed. Created a new one https://github.com/linkedin/dex-test-parser/issues/72.

BenedictP commented 2 years ago

With the 2.3.4 release of dex-test-parse the issue should be fixed:

dmitry-ryadnenko-izettle commented 2 years ago

@bootstraponline I've made a PR with the fix. I don't want to sign the CLA, I'm not sure if it's allowed in our company to do such things. So, can you please make a copy of my PR instead?

dmitry-ryadnenko-izettle commented 2 years ago

The fix is just a bump of dex-parser. But we are blocked in several directions of our work without this fix to the Flank.

mattcarron commented 2 years ago

Hi @bootstraponline my team are also affected by this Exception when upgrading to SDK 31 it will be great to the PR @dmitry-ryadnenko-izettle raised incorporated. Thank you for working to resolve this 👍

bootstraponline commented 2 years ago

Hey, thanks for the comments. I merged the fix. A few unrelated deps are causing problems, once I debug that I'll push a new release.

Please share your feedback with Sam Phillips (new FTL product manager) on the Firebase Test Lab Slack. I'm encouraging Google to sponsor a dev to work full time on maintaining the open source FTL ecosystem. That'll significantly improve the response time for issues like this.

bootstraponline commented 2 years ago

http://github.com/Flank/flank/releases/tag/v22.03.0