LuciferYang commented on a change in pull request #29783:
URL: https://github.com/apache/spark/pull/29783#discussion_r490089526



##########
File path: 
sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/HiveMetastoreLazyInitializationSuite.scala
##########
@@ -31,6 +31,7 @@ class HiveMetastoreLazyInitializationSuite extends 
SparkFunSuite {
       .config("spark.hadoop.hive.metastore.uris", "thrift://127.0.0.1:11111")
       .getOrCreate()
     val originalLevel = org.apache.log4j.Logger.getRootLogger().getLevel
+    val originalClassLoader = Thread.currentThread().getContextClassLoader

Review comment:
       This change is very Interesting, `HiveThriftServer2ListenerSuite ` will 
ABORTED without this change
   ```
   HiveThriftServer2ListenerSuite:
   *** RUN ABORTED ***
     java.lang.LinkageError: loader constraint violation: loader (instance of 
net/bytebuddy/dynamic/loading/MultipleParentClassLoader) previously initiated 
loading for a different type with name 
"org/apache/hive/service/ServiceStateChangeListener"
     at 
org.mockito.codegen.HiveThriftServer2$MockitoMock$1850222569.<clinit>(Unknown 
Source)
     at 
sun.reflect.GeneratedSerializationConstructorAccessor530.newInstance(Unknown 
Source)
     at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
     at 
org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator.newInstance(SunReflectionFactoryInstantiator.java:48)
     at org.objenesis.ObjenesisBase.newInstance(ObjenesisBase.java:73)
     at 
org.mockito.internal.creation.instance.ObjenesisInstantiator.newInstance(ObjenesisInstantiator.java:19)
     at 
org.mockito.internal.creation.bytebuddy.SubclassByteBuddyMockMaker.createMock(SubclassByteBuddyMockMaker.java:47)
     at 
org.mockito.internal.creation.bytebuddy.ByteBuddyMockMaker.createMock(ByteBuddyMockMaker.java:25)
     at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:35)
     at org.mockito.internal.MockitoCore.mock(MockitoCore.java:63)
     ...
   
   ```
    The Context Class Loader is `NonClosableMutableURLClassLoader` in 
`HiveMetastoreLazyInitializationSuite` running process and the 
`NonClosableMutableURLClassLoader` propagate to 
`HiveThriftServer2ListenerSuite`  




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to