[ 
https://issues.apache.org/jira/browse/HIVE-20665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16964603#comment-16964603
 ] 

Hive QA commented on HIVE-20665:
--------------------------------



Here are the results of testing the latest attachment:
https://issues.apache.org/jira/secure/attachment/12984511/HIVE-20665.2.patch

{color:red}ERROR:{color} -1 due to no test(s) being added or modified.

{color:red}ERROR:{color} -1 due to 10 failed/errored test(s), 17546 tests 
executed
*Failed tests:*
{noformat}
org.apache.hadoop.hive.cli.TestHBaseCliDriver.testCliDriver[hbase_handler_bulk] 
(batchId=109)
org.apache.hadoop.hive.cli.TestKuduNegativeCliDriver.testCliDriver[kudu_config] 
(batchId=290)
org.apache.hadoop.hive.cli.TestMiniDruidCliDriver.testCliDriver[druid_timestamptz2]
 (batchId=198)
org.apache.hadoop.hive.cli.TestMiniDruidCliDriver.testCliDriver[druidmini_dynamic_partition]
 (batchId=198)
org.apache.hadoop.hive.cli.TestMiniDruidCliDriver.testCliDriver[druidmini_mv] 
(batchId=198)
org.apache.hadoop.hive.cli.TestMiniDruidCliDriver.testCliDriver[druidmini_test_alter]
 (batchId=198)
org.apache.hadoop.hive.cli.TestMiniDruidCliDriver.testCliDriver[druidmini_test_insert]
 (batchId=198)
org.apache.hadoop.hive.cli.TestMiniHiveKafkaCliDriver.testCliDriver[kafka_storage_handler]
 (batchId=299)
org.apache.hadoop.hive.cli.TestNegativeCliDriver.testCliDriver[druid_address] 
(batchId=102)
org.apache.hadoop.hive.ql.exec.spark.TestSparkUtilities.testGetSparkSessionUsingMultipleThreadsWithTheSameSession
 (batchId=346)
{noformat}

Test results: 
https://builds.apache.org/job/PreCommit-HIVE-Build/19243/testReport
Console output: https://builds.apache.org/job/PreCommit-HIVE-Build/19243/console
Test logs: http://104.198.109.242/logs/PreCommit-HIVE-Build-19243/

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: 10 tests failed
{noformat}

This message is automatically generated.

ATTACHMENT ID: 12984511 - PreCommit-HIVE-Build

> Hive Parallel Tasks - Hive Configuration ConcurrentModificationException
> ------------------------------------------------------------------------
>
>                 Key: HIVE-20665
>                 URL: https://issues.apache.org/jira/browse/HIVE-20665
>             Project: Hive
>          Issue Type: Bug
>          Components: HiveServer2
>    Affects Versions: 2.3.2, 3.1.0, 4.0.0
>            Reporter: David Mollitor
>            Assignee: David Mollitor
>            Priority: Major
>         Attachments: HIVE-20665.1.patch, HIVE-20665.2.patch
>
>
> When parallel tasks are enabled in Hive, all of the resulting queries share 
> the same Hive configuration.  This is problematic as each query will modify 
> the same {{HiveConf}} object with things like query ID and query text.  This 
> will overwrite each other and cause {{ConcurrentModificationException}} 
> issues.
> {code:java|title=SQLOperation.java}
>         public Object run() throws HiveSQLException {
>           Hive.set(parentHive, false);
>           // TODO: can this result in cross-thread reuse of session state?
>           SessionState.setCurrentSessionState(parentSessionState);
>           PerfLogger.setPerfLogger(SessionState.getPerfLogger());
>           LogUtils.registerLoggingContext(queryState.getConf());
>           try {
>             if (asyncPrepare) {
>               prepare(queryState);
>             }
>             runQuery();
>           } catch (HiveSQLException e) {
> // ...
> {code}
> [Code 
> Here|https://github.com/apache/hive/blob/6e27a5315a44c55ef3b178e7212c9068de322d01/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java#L308-L319]
> From this code it can be seen that for every thread launched, it is all 
> calling {{setCurrentSessionState}}.
> {code:java|title=SessionStates.java}
>   /**
>    * Sets the given session state in the thread local var for sessions.
>    */
>   public static void setCurrentSessionState(SessionState startSs) {
>     tss.get().attach(startSs);
>   }
>   // SessionState is not available in runtime and Hive.get().getConf() is not 
> safe to call
>   private static class SessionStates {
>     private SessionState state;
>     private HiveConf conf;
>     private void attach(SessionState state) {
>       this.state = state;
>       attach(state.getConf());
>     }
>     private void attach(HiveConf conf) {
>       // -- SHALLOW COPY HERE, ALL THREADS SHARING SAME REFERENCE -- //
>       this.conf = conf;
>       ClassLoader classLoader = conf.getClassLoader();
>       if (classLoader != null) {
>         Thread.currentThread().setContextClassLoader(classLoader);
>       }
>     }
>   }
> {code}
> [Code 
> Here|https://github.com/apache/hive/blob/7795c0a7dc59941671f8845d78b16d9e5ddc9ea3/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java#L540-L556]
> Ensure that all threads get their own copy of the {{HiveConf}} object to use 
> and modify.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to