Long term solution would be: https://issues.apache.org/jira/browse/HIVE-24549
Short term solution for the common usage pattern described in HIVE-24549 is to ensure the current driverContext queryId matches the TxnManagers queryId.
Transaction is not aborted when query cancelled, only when session is closed
TxnManager should not be shared across queries
GitHub Pull Request #1795
GitHub Pull Request #1836