Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-3789

debug action "PREPARE:WAIT" could cause deadlock and query cannot be cancelled

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: Impala 2.7.0
    • Fix Version/s: None
    • Component/s: Backend
    • Labels:
      None

      Description

      If debug action is set to "PREPARE:WAIT", Prepare() will call ExecDebugAction() and wait in a loop. However, the query cannot be cancelled.

      Status ExecNode::ExecDebugAction() {
      ...
        if (debug_action_ == TDebugAction::WAIT) {
          while (!state->is_cancelled()) {
            sleep(1);
          }
          return Status::CANCELLED;
        }
      ...
      }
      

      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.

      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());
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                jyu@cloudera.com Juan Yu
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: