apache / apache/hudi

Mockito-inline has conflict with docker Image

Open
#16,620 1 comment 0 reactions 1 assignee Assigned to @linliu-code View on GitHub
from-jira priority:high type:bug
Dominant language
Java
Stars
6.2k
Forks
2.5k
Avg merge
2d 8h
Merged PRs (30d)
111

Description

When Mockito-inline is added to `hudi-tests-common`, this library will be included to tests that run in our docker image in Azure CI, and the underlying library ByteBuddy will have conflicts with the docker image.

 

Currently solution is to avoid adding `mockito-inline` to `hudi-tests-common` to avoid the conflicts. But if some tests that run in docker image have to use mockito-inline, we will need to solve the problem.

 
{code:java}
Caused by: java.lang.IllegalStateException: Failed to load interface org.mockito.plugins.MockMaker implementation declared in sun.misc.CompoundEnumeration@138f0661
at org.mockito.internal.configuration.plugins.PluginInitializer.loadImpl(PluginInitializer.java:58)
at org.mockito.internal.configuration.plugins.PluginLoader.loadPlugin(PluginLoader.java:69)
at org.mockito.internal.configuration.plugins.PluginLoader.loadPlugin(PluginLoader.java:54)
at org.mockito.internal.configuration.plugins.PluginRegistry.(PluginRegistry.java:29)
at org.mockito.internal.configuration.plugins.Plugins.(Plugins.java:20)
at org.mockito.internal.util.MockUtil.(MockUtil.java:28)
... 76 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.mockito.internal.configuration.plugins.PluginInitializer.loadImpl(PluginInitializer.java:53)
... 81 more
Caused by: org.mockito.exceptions.base.MockitoInitializationException:
Could not initialize inline Byte Buddy mock maker.

It appears as if your JDK does not supply a working agent attachment mechanism.
Java : 1.8
JVM vendor name : Temurin
JVM vendor version : 25.402-b06
JVM name : OpenJDK 64-Bit Server VM
JVM version : 1.8.0_402-b06
JVM info : mixed mode
OS name : Linux
OS version : 6.8.0-1014-azure

  at org.mockito.internal.creation.bytebuddy.InlineDelegateByteBuddyMockMaker.(InlineDelegateByteBuddyMockMaker.java:246)
at org.mockito.internal.creation.bytebuddy.InlineByteBuddyMockMaker.(InlineByteBuddyMockMaker.java:25)
... 86 more
Caused by: java.lang.IllegalStateException: Error during attachment using: net.bytebuddy.agent.ByteBuddyAgent$AttachmentProvider$Compound@6459f4ea
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:636)
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:609)
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:561)
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:538)
at org.mockito.internal.creation.bytebuddy.InlineDelegateByteBuddyMockMaker.(InlineDelegateByteBuddyMockMaker.java:117)
... 87 more
Caused by: java.lang.reflect.InvocationTargetException
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 net.bytebuddy.agent.Attacher.install(Attacher.java:106)
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:631)
... 91 more
Caused by: java.lang.UnsatisfiedLinkError: Native Library /opt/java/openjdk/jre/lib/amd64/libattach.so already loaded in another classloader
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1900)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1838)
at java.lang.Runtime.loadLibrary0(Runtime.java:843)
at java.lang.System.loadLibrary(System.java:1136)
at sun.tools.attach.LinuxVirtualMachine.(LinuxVirtualMachine.java:343)
at sun.tools.attach.LinuxAttachProvider.attachVirtualMachine(LinuxAttachProvider.java:63)
at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:208)
... 97 more
{code}

## JIRA info

- Link: https://issues.apache.org/jira/browse/HUDI-8217
- Type: Bug
- Fix version(s):
- 1.1.0

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.