You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "Tim Armstrong (JIRA)" <ji...@apache.org> on 2017/11/22 21:42:00 UTC

[jira] [Resolved] (IMPALA-3789) debug action "PREPARE:WAIT" could cause deadlock and query cannot be cancelled

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

Tim Armstrong resolved IMPALA-3789.
-----------------------------------
    Resolution: Duplicate

> debug action "PREPARE:WAIT" could cause deadlock and query cannot be cancelled
> ------------------------------------------------------------------------------
>
>                 Key: IMPALA-3789
>                 URL: https://issues.apache.org/jira/browse/IMPALA-3789
>             Project: IMPALA
>          Issue Type: Improvement
>          Components: Backend
>    Affects Versions: Impala 2.7.0
>            Reporter: Juan Yu
>            Priority: Minor
>
> If debug action is set to "PREPARE:WAIT", Prepare() will call  ExecDebugAction() and wait in a loop. However, the query cannot be cancelled.
> {code}
> Status ExecNode::ExecDebugAction() {
> ...
>   if (debug_action_ == TDebugAction::WAIT) {
>     while (!state->is_cancelled()) {
>       sleep(1);
>     }
>     return Status::CANCELLED;
>   }
> ...
> }
> {code}
> This is because Cancel() needs to get "prepare_lock_" to set cancel state. the lock is still hold by Prepare() which is stuck in a loop wait for cancel.
> {code}
> void PlanFragmentExecutor::Cancel() {
>   VLOG_QUERY << "Cancelling plan fragment...";
>   lock_guard<mutex> l(prepare_lock_);
>   is_cancelled_ = true;
>   if (!is_prepared_) {
>     VLOG_QUERY << "Cancel() called before Prepare()";
>     return;
>   }
>   DCHECK(runtime_state_ != NULL);
>   VLOG_QUERY << "Cancel(): instance_id=" << runtime_state_->fragment_instance_id();
>   runtime_state_->set_is_cancelled(true);
>   runtime_state_->stream_mgr()->Cancel(runtime_state_->fragment_instance_id());
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)