[
https://issues.apache.org/jira/browse/HIVE-14799?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15549806#comment-15549806
]
Sergey Shelukhin commented on HIVE-14799:
-----------------------------------------
Hmm.. wouldn't the thread just get interrupted and die on the next waiting
operation?
Overall I wonder if simple solution is possible where we merely ensure that one
thread does the cleanup.
The states needed are "driver is responsible", "driver is not responsible",
"driver should cleanup", "cleanup".
The first two are set by driver depending on whether it would handle interrupt
from there on.
If the driver is responsible, the stopping thread can set (atomically) "should
cleanup", interrupt the driver thread via system call and exit (does it have to
wait?)
If the driver is not, the stopping thread can set "cleanup" atomically and do
it.
The driver would have the interrupt and maybe the periodic checks to see when
it should clean up. Again it would atomically set state to cleanup and clean up.
That way only one thread can clean up, and the stopping thread can only do when
driver is AWOL.
> Query operation are not thread safe during its cancellation
> -----------------------------------------------------------
>
> Key: HIVE-14799
> URL: https://issues.apache.org/jira/browse/HIVE-14799
> Project: Hive
> Issue Type: Bug
> Components: HiveServer2
> Reporter: Chaoyu Tang
> Assignee: Chaoyu Tang
> Attachments: HIVE-14799.patch
>
>
> When a query is cancelled either via Beeline (Ctrl-C) or API call
> TCLIService.Client.CancelOperation, SQLOperation.cancel is invoked in a
> different thread from that running the query to close/destroy its
> encapsulated Driver object. Both SQLOperation and Driver are not thread-safe
> which could sometimes result in Runtime exceptions like NPE. The errors from
> the running query are not handled properly therefore probably causing some
> stuffs (files, locks etc) not being cleaned after the query termination.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)