[
https://issues.apache.org/jira/browse/HIVE-20682?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16663663#comment-16663663
]
Hive QA commented on HIVE-20682:
--------------------------------
Here are the results of testing the latest attachment:
https://issues.apache.org/jira/secure/attachment/12945528/HIVE-20682.02.patch
{color:green}SUCCESS:{color} +1 due to 1 test(s) being added or modified.
{color:red}ERROR:{color} -1 due to 11 failed/errored test(s), 15502 tests
executed
*Failed tests:*
{noformat}
TestMiniDruidCliDriver - did not produce a TEST-*.xml file (likely timed out)
(batchId=195)
[druidmini_dynamic_partition.q,druidmini_test_ts.q,druidmini_expressions.q,druidmini_test_alter.q,druidmini_test_insert.q]
org.apache.hadoop.hive.ql.parse.authorization.TestSessionUserName.testSessionConstructorUser
(batchId=300)
org.apache.hadoop.hive.ql.parse.authorization.TestSessionUserName.testSessionDefaultUser
(batchId=300)
org.apache.hadoop.hive.ql.parse.authorization.TestSessionUserName.testSessionGetGroupNames
(batchId=300)
org.apache.hadoop.hive.ql.parse.authorization.TestSessionUserName.testSessionNullUser
(batchId=300)
org.apache.hive.service.cli.session.TestSessionManagerMetrics.testAbandonedSessionMetrics
(batchId=234)
org.apache.hive.service.cli.session.TestSessionManagerMetrics.testActiveSessionMetrics
(batchId=234)
org.apache.hive.service.cli.session.TestSessionManagerMetrics.testActiveSessionTimeMetrics
(batchId=234)
org.apache.hive.service.cli.session.TestSessionManagerMetrics.testOpenSessionMetrics
(batchId=234)
org.apache.hive.service.cli.session.TestSessionManagerMetrics.testOpenSessionTimeMetrics
(batchId=234)
org.apache.hive.service.cli.session.TestSessionManagerMetrics.testThreadPoolMetrics
(batchId=234)
{noformat}
Test results:
https://builds.apache.org/job/PreCommit-HIVE-Build/14638/testReport
Console output: https://builds.apache.org/job/PreCommit-HIVE-Build/14638/console
Test logs: http://104.198.109.242/logs/PreCommit-HIVE-Build-14638/
Messages:
{noformat}
Executing org.apache.hive.ptest.execution.TestCheckPhase
Executing org.apache.hive.ptest.execution.PrepPhase
Executing org.apache.hive.ptest.execution.YetusPhase
Executing org.apache.hive.ptest.execution.ExecutionPhase
Executing org.apache.hive.ptest.execution.ReportingPhase
Tests exited with: TestsFailedException: 11 tests failed
{noformat}
This message is automatically generated.
ATTACHMENT ID: 12945528 - PreCommit-HIVE-Build
> Async query execution can potentially fail if shared sessionHive is closed by
> master thread.
> --------------------------------------------------------------------------------------------
>
> Key: HIVE-20682
> URL: https://issues.apache.org/jira/browse/HIVE-20682
> Project: Hive
> Issue Type: Bug
> Components: HiveServer2
> Affects Versions: 3.1.0, 4.0.0
> Reporter: Sankar Hariappan
> Assignee: Sankar Hariappan
> Priority: Major
> Labels: pull-request-available
> Attachments: HIVE-20682.01.patch, HIVE-20682.02.patch
>
>
> *Problem description:*
> The master thread initializes the *sessionHive* object in *HiveSessionImpl*
> class when we open a new session for a client connection and by default all
> queries from this connection shares the same sessionHive object.
> If the master thread executes a *synchronous* query, it closes the
> sessionHive object (referred via thread local hiveDb) if
> {{Hive.isCompatible}} returns false and sets new Hive object in thread local
> HiveDb but doesn't change the sessionHive object in the session. Whereas,
> *asynchronous* query execution via async threads never closes the sessionHive
> object and it just creates a new one if needed and sets it as their thread
> local hiveDb.
> So, the problem can happen in the case where an *asynchronous* query is being
> executed by async threads refers to sessionHive object and the master thread
> receives a *synchronous* query that closes the same sessionHive object.
> Also, each query execution overwrites the thread local hiveDb object to
> sessionHive object which potentially leaks a metastore connection if the
> previous synchronous query execution re-created the Hive object.
> *Possible Fix:*
> We shall maintain an Atomic reference counter in the Hive object. We
> increment the counter when somebody sets it in thread local hiveDb and
> decrement it when somebody releases it. Only when the counter is down to 0,
> we should close the connection.
> Couple of cases to release the thread local hiveDb:
> * When synchronous query execution in master thread re-creates Hive object
> due to config change. We also, need to update the sessionHive object in the
> current session as we releases it from thread local hiveDb of master thread.
> * When async thread exits after completing execution or due to exception.
> If the session is getting closed, it is guaranteed that the reference counter
> is down to 0 as we forcefully close all the async operations and so we can
> close the connection there.
> cc [~pvary]
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)