You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Aron Hamvas (Jira)" <ji...@apache.org> on 2019/10/30 10:41:00 UTC

[jira] [Updated] (HIVE-22420) DbTxnManager.stopHeartbeat() should be thread-safe

     [ https://issues.apache.org/jira/browse/HIVE-22420?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aron Hamvas updated HIVE-22420:
-------------------------------
    Summary: DbTxnManager.stopHeartbeat() should be thread-safe  (was: Driver.releaseLocksAndCommitOrRollback is not thread safe)

> DbTxnManager.stopHeartbeat() should be 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)