[
https://issues.apache.org/jira/browse/HIVE-22420?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Aron Hamvas reassigned HIVE-22420:
----------------------------------
> Driver.releaseLocksAndCommitOrRollback is not thread safe
> ---------------------------------------------------------
>
> Key: HIVE-22420
> URL: https://issues.apache.org/jira/browse/HIVE-22420
> Project: Hive
> Issue Type: Bug
> Affects Versions: 3.1.0
> Reporter: Aron Hamvas
> Assignee: Aron Hamvas
> Priority: Major
>
> When a transactional query is being executed and interrupted via HS2 close
> operation request, both the background pool thread executing the query and
> the HttpHandler thread running the close operation logic will eventually call
> the below method:
> {noformat}
> Driver.releaseLocksAndCommitOrRollback(commit boolean)
> {noformat}
> Since this method is invoked several times in both threads, it can happen
> that the two threads invoke it at the same time, and due to a race
> condition, the txnId field of the DbTxnManager used by both threads could be
> set to 0 without actually successfully aborting the transaction.
> E.g. if the two threads reach the stopHeartbeat() call at the same time, one
> will set the heartbeat task to null, the other will run into a
> NullPointerException and due to the unsuccessful call, set the value of txnId
> to 0 before the other thread (which successfully ran the stopHeartbeat()
> call) could invoke rollback on HMS with the proper txnId.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)