hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hive QA (JIRA)" <>
Subject [jira] [Commented] (HIVE-20682) Async query execution can potentially fail if shared sessionHive is closed by master thread.
Date Thu, 08 Nov 2018 07:35:00 GMT


Hive QA commented on HIVE-20682:

Here are the results of testing the latest attachment:

{color:green}SUCCESS:{color} +1 due to 2 test(s) being added or modified.

{color:red}ERROR:{color} -1 due to 1 failed/errored test(s), 15526 tests executed
*Failed tests:*
org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver[timestamptz_2] (batchId=85)

Test results:
Console output:
Test logs:

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: 1 tests failed

This message is automatically generated.

ATTACHMENT ID: 12947256 - PreCommit-HIVE-Build

> Async query execution can potentially fail if shared sessionHive is closed by master
> --------------------------------------------------------------------------------------------
>                 Key: HIVE-20682
>                 URL:
>             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, HIVE-20682.03.patch, HIVE-20682.04.patch,
HIVE-20682.05.patch, HIVE-20682.06.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:*
> The *sessionHive* object could be shared my multiple threads and so it shouldn't be allowed
to be closed by any query execution threads when they re-create the Hive object due to changes
in Hive configurations. But the Hive objects created by query execution threads should be
closed when the thread exits.
> So, it is proposed to have an *isAllowClose* flag (default: *true*) in Hive object which
should be set to *false* for *sessionHive* and would be forcefully closed when the session
is closed or released.
> Also, when we reset *sessionHive* object with new one due to changes in *sessionConf*,
the old one should be closed when no async thread is referring to it. This can be done using
"*finalize*" method of Hive object where we can close HMS connection when Hive object is garbage
> cc [~pvary]

This message was sent by Atlassian JIRA

View raw message