deniskuzZ commented on code in PR #4180:
URL: https://github.com/apache/hive/pull/4180#discussion_r1175743602


##########
service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java:
##########
@@ -401,11 +401,11 @@ private synchronized void acquireAfterOpLock(boolean 
userAccess) {
     // set the thread name with the logging prefix.
     sessionState.updateThreadName();
 
-    try {
-      setSessionHive();
-    } catch (HiveSQLException e) {
-      throw new RuntimeException(e);
-    }
+    // If Hive.get() is being shared across different sessions,
+    // sessionHive and Hive.get() may be different, in such case,
+    // the risk of deadlock on HiveMetaStoreClient#SynchronizedHandler can 
happen.
+    // Refresh the thread-local Hive to avoid the deadlock.
+    Hive.set(sessionHive);

Review Comment:
   the idea of HIVE-25085 was that MetaStore Clients no longer shared across 
sessions. if that is true, how that could cause a deadlock? 
   Would we GC session in ThreadLocal that we replace?



-- 
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.

To unsubscribe, e-mail: [email protected]

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