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

Vihang Karajgaonkar commented on HIVE-16213:
--------------------------------------------

Discussed with [~akolb] offline. He agrees that implementing Autocloseable 
wrapper around query is a big refactor and may not be worth the effort involved 
since it is going to be available from JDO 3.2. We can start consuming the 
autocloseable Query when we update the JDO API to 3.2 in Hive. For now this 
solution is good. Creating a review board link

https://reviews.apache.org/r/58516/

[~spena] [~akolb] [~stakiar] Can you please review? Thanks!

> ObjectStore can leak Queries when rollbackTransaction throws an exception
> -------------------------------------------------------------------------
>
>                 Key: HIVE-16213
>                 URL: https://issues.apache.org/jira/browse/HIVE-16213
>             Project: Hive
>          Issue Type: Bug
>          Components: Hive
>            Reporter: Alexander Kolbasov
>            Assignee: Vihang Karajgaonkar
>         Attachments: HIVE-16213.01.patch
>
>
> In ObjectStore.java there are a few places with the code similar to:
> {code}
>     Query query = null;
>     try {
>       openTransaction();
>       query = pm.newQuery(Something.class);
>       ...
>       commited = commitTransaction();
>     } finally {
>       if (!commited) {
>         rollbackTransaction();
>       }
>       if (query != null) {
>         query.closeAll();
>       }
>     }
> {code}
> The problem is that rollbackTransaction() may throw an exception in which 
> case query.closeAll() wouldn't be executed. 
> The fix would be to wrap rollbackTransaction in its own try-catch block.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to