Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Intermittent test failure - org.mozilla.fenix.library.history.HistoryControllerTest.onCopyItem #20533

Closed
jonalmeida opened this issue Jul 27, 2021 · 2 comments
Labels
eng:intermittent-test Evil test failures that only happen now-and-then and are a productivity killer needs:triage Issue needs triage

Comments

@jonalmeida
Copy link
Contributor

jonalmeida commented Jul 27, 2021

TC link: https://firefox-ci-tc.services.mozilla.com/tasks/IHY86EjRTY2vphNVgDIHww/runs/0/logs/public/logs/live.log

io.mockk.MockKException: Can't instantiate proxy for class kotlin.Function0
	at io.mockk.impl.instantiation.JvmMockFactory.newProxy(JvmMockFactory.kt:64)
	at io.mockk.impl.instantiation.AbstractMockFactory.newProxy$default(AbstractMockFactory.kt:29)
	at io.mockk.impl.instantiation.AbstractMockFactory.mockk(AbstractMockFactory.kt:59)
	at org.mozilla.fenix.library.history.HistoryControllerTest.<init>(HistoryControllerTest.kt:450)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:217)
	at org.robolectric.RobolectricTestRunner$HelperTestRunner.createTest(RobolectricTestRunner.java:556)
	at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:266)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:263)
	at org.robolectric.internal.SandboxTestRunner$HelperTestRunner.methodBlock(SandboxTestRunner.java:344)
	at org.robolectric.RobolectricTestRunner$HelperTestRunner.methodBlock(RobolectricTestRunner.java:565)
	at org.robolectric.internal.SandboxTestRunner$2.lambda$evaluate$0(SandboxTestRunner.java:274)
	at org.robolectric.internal.bytecode.Sandbox.lambda$runOnMainThread$0(Sandbox.java:89)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: io.mockk.proxy.MockKAgentException: Failed to subclass interface kotlin.jvm.functions.Function0
	at io.mockk.proxy.jvm.ProxyMaker.proxy(ProxyMaker.kt:38)
	at io.mockk.impl.instantiation.JvmMockFactory.newProxy(JvmMockFactory.kt:34)
	... 20 more
Caused by: java.lang.IllegalArgumentException: Could not create type
	at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:155)
	at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:175)
	at io.mockk.proxy.jvm.transformation.SubclassInstrumentation.subclass(SubclassInstrumentation.kt:51)
	at io.mockk.proxy.jvm.ProxyMaker.subclass(ProxyMaker.kt:113)
	at io.mockk.proxy.jvm.ProxyMaker.proxy(ProxyMaker.kt:35)
	... 21 more
Caused by: java.lang.IllegalStateException: Failed to invoke proxy for public abstract java.lang.Class net.bytebuddy.dynamic.loading.ClassInjector$UsingLookup$MethodHandles$Lookup.defineClass(java.lang.Object,byte[]) throws java.lang.IllegalAccessException
	at net.bytebuddy.utility.dispatcher.JavaDispatcher$ProxiedInvocationHandler.invoke(JavaDispatcher.java:1123)
	at com.sun.proxy.$Proxy73.defineClass(Unknown Source)
	at net.bytebuddy.dynamic.loading.ClassInjector$UsingLookup.injectRaw(ClassInjector.java:1621)
	at net.bytebuddy.dynamic.loading.ClassInjector$AbstractBase.inject(ClassInjector.java:113)
	at net.bytebuddy.dynamic.loading.ClassLoadingStrategy$UsingLookup.load(ClassLoadingStrategy.java:492)
	at net.bytebuddy.dynamic.TypeResolutionStrategy$Passive.initialize(TypeResolutionStrategy.java:100)
	at net.bytebuddy.dynamic.DynamicType$Default$Unloaded.load(DynamicType.java:6147)
	at io.mockk.proxy.jvm.transformation.SubclassInstrumentation.doInterceptedSubclassing(SubclassInstrumentation.kt:98)
	at io.mockk.proxy.jvm.transformation.SubclassInstrumentation.access$doInterceptedSubclassing(SubclassInstrumentation.kt:21)
	at io.mockk.proxy.jvm.transformation.SubclassInstrumentation$subclass$1.call(SubclassInstrumentation.kt:54)
	at io.mockk.proxy.jvm.transformation.SubclassInstrumentation$subclass$1.call(SubclassInstrumentation.kt:21)
	at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:153)
	... 25 more
Caused by: java.lang.LinkageError: loader 'app' attempted duplicate class definition for kotlin.jvm.functions.Function0$Subclass6. (kotlin.jvm.functions.Function0$Subclass6 is in unnamed module of loader 'app')
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.System$2.defineClass(System.java:2131)
	at java.base/java.lang.invoke.MethodHandles$Lookup.defineClass(MethodHandles.java:962)
	at java.base/jdk.internal.reflect.GeneratedMethodAccessor41.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at net.bytebuddy.utility.dispatcher.JavaDispatcher$Invoker$Dispatcher.invoke(Unknown Source)
	at net.bytebuddy.utility.dispatcher.JavaDispatcher$Dispatcher$ForNonStaticMethod.invoke(JavaDispatcher.java:986)
	at net.bytebuddy.utility.dispatcher.JavaDispatcher$ProxiedInvocationHandler.invoke(JavaDispatcher.java:1110)
	... 36 more

┆Issue is synchronized with this Jira Task

@mcomella
Copy link
Contributor

mcomella commented Jul 27, 2021

I think this intermittent might be in a greater scope than this test. I assume it's related to the Java 11 upgrade. Here are other similar failures I found:

It seems like the root issue is that arbitrary unit tests fail with an exception related to proxy/mocking classes.

csadilek added a commit to csadilek/fenix that referenced this issue Jul 28, 2021
csadilek added a commit to csadilek/fenix that referenced this issue Jul 28, 2021
csadilek added a commit to csadilek/fenix that referenced this issue Jul 28, 2021
csadilek added a commit to csadilek/fenix that referenced this issue Jul 28, 2021
@csadilek
Copy link
Contributor

csadilek commented Jul 28, 2021

We've worked around all those known test failures for now (by not mocking lambdas) until we understand what the root cause is. Since this is too painful otherwise, let's land those test changes. Let's keep an eye out and do another iteration if needed.

@mergify mergify bot closed this as completed in f03f7c6 Jul 28, 2021
csadilek added a commit to csadilek/fenix that referenced this issue Jul 29, 2021
csadilek added a commit to csadilek/fenix that referenced this issue Jul 29, 2021
csadilek added a commit to csadilek/fenix that referenced this issue Jul 30, 2021
csadilek added a commit to csadilek/fenix that referenced this issue Jul 30, 2021
csadilek added a commit to csadilek/fenix that referenced this issue Jul 30, 2021
csadilek added a commit to csadilek/fenix that referenced this issue Jul 30, 2021
mergify bot pushed a commit that referenced this issue Jul 30, 2021
csadilek added a commit to csadilek/fenix that referenced this issue Jul 30, 2021
csadilek added a commit to csadilek/fenix that referenced this issue Jul 30, 2021
csadilek added a commit to csadilek/fenix that referenced this issue Jul 30, 2021
pocmo pushed a commit that referenced this issue Aug 2, 2021
czlucius pushed a commit to czlucius/fenix that referenced this issue Aug 20, 2021
czlucius pushed a commit to czlucius/fenix that referenced this issue Aug 20, 2021
czlucius pushed a commit to czlucius/fenix that referenced this issue Aug 20, 2021
czlucius pushed a commit to czlucius/fenix that referenced this issue Aug 20, 2021
czlucius pushed a commit to czlucius/fenix that referenced this issue Aug 20, 2021
czlucius pushed a commit to czlucius/fenix that referenced this issue Aug 20, 2021
czlucius pushed a commit to czlucius/fenix that referenced this issue Aug 22, 2021
czlucius pushed a commit to czlucius/fenix that referenced this issue Aug 22, 2021
czlucius pushed a commit to czlucius/fenix that referenced this issue Aug 22, 2021
czlucius pushed a commit to czlucius/fenix that referenced this issue Aug 22, 2021
czlucius pushed a commit to czlucius/fenix that referenced this issue Aug 22, 2021
czlucius pushed a commit to czlucius/fenix that referenced this issue Aug 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
eng:intermittent-test Evil test failures that only happen now-and-then and are a productivity killer needs:triage Issue needs triage
Projects
None yet
Development

No branches or pull requests

3 participants