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

Impala crashes in PhjBuilder::Close() when Prepare() fails

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • Impala 4.1.0
    • Backend
    • None
    • ghx-label-1

    Description

      Currently PhjBuilder::Close() looks like the following:

      void PhjBuilder::Close(RuntimeState* state) {
        if (closed_) return;
        CloseAndDeletePartitions(nullptr);
        if (ht_ctx_ != nullptr) {
          ht_ctx_->StatsCountersAdd(ht_stats_profile_.get());
          ht_ctx_->Close(state);
          ht_ctx_.reset();
        }
      ...
      

      When 'ht_ctx_' is not null, we invoke ht_ctx_->StatsCountersAdd(ht_stats_profile_.get());

      But in Prepare() we create 'ht_ctx_' first, then after a couple operations which might fail we create 'ht_stats_profile_'.

      This means if an operation fails in Prepare(), between the creation of 'ht_ctx_' and 'ht_stast_profile_', then later we'll get a SEGFAULT in Close().

      The stack trace would look like the following:

      #0  impala::HashTableCtx::StatsCountersAdd (this=0x3ea4ddc80, profile=0x0) at hash-table.cc:229
      #1  0x0000000001545c4c in impala::PhjBuilder::Close (this=0xbf6523c0, state=0x2eb586c00) at partitioned-hash-join-builder.cc:395
      #2  0x00000000015e4056 in impala::JoinBuilder::CloseFromProbe (this=0xbf6523c0, join_node_state=join_node_state@entry=0x2eb586c00) at join-builder.cc:64
      #3  0x0000000001550fdb in impala::PartitionedHashJoinNode::Close (this=0x214654480, state=0x2eb586c00) at partitioned-hash-join-node.cc:306
      #4  0x00000000014ab5e1 in impala::ExecNode::Close (this=0xc34db5680, state=0x2eb586c00) at exec-node.cc:313
      #5  0x00000000014ab5e1 in impala::ExecNode::Close (this=0x1980bdcd80, state=0x2eb586c00) at exec-node.cc:313
      ...
      #16 0x00000000014ab5e1 in impala::ExecNode::Close (this=0x6faf3e000, state=0x2eb586c00) at exec-node.cc:313
      #17 0x00000000014ab5e1 in impala::ExecNode::Close (this=0x86bc5e000, state=0x2eb586c00) at exec-node.cc:313
      #18 0x0000000001198ebe in impala::FragmentInstanceState::Close (this=this@entry=0x12183fb180) at fragment-instance-state.cc:411
      #19 0x000000000119ba47 in impala::FragmentInstanceState::Exec (this=this@entry=0x12183fb180) at fragment-instance-state.cc:104
      

      The solution could be to initialize the counters first, like we do in grouping-aggregators.cc.

      Attachments

        Activity

          People

            boroknagyz Zoltán Borók-Nagy
            boroknagyz Zoltán Borók-Nagy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: