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

Codegen crash due to null slots

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • Impala 4.0.0, Impala 4.1.0, Impala 4.2.0, Impala 4.1.1
    • Impala 4.1.2, Impala 4.3.0
    • None
    • None

    Description

      Simple repro:

      create table if not exists tbl (id int);
      
      with v1 as (
        select '0' as a1, '' as b1 from tbl 
      ), v2 as (
        select '' as a2, null as b2
      ), v3 as (
        select b1 as b
        from v1 left join v2 on a1 = a2
      )
      select 1 from (
        select row_number() over (partition by b order by b) rnk 
        from v3
      ) v
      where rnk = 1;
      

      My local branch is at 8cd4a1e4e of the master branch. The backtrace in RELEASE build:

      #0  0x00000000034d732a in llvm::FunctionType::get(llvm::Type*, llvm::ArrayRef<llvm::Type*>, bool) ()
      #1  0x0000000001b6372c in impala::LlvmCodeGen::FnPrototype::GeneratePrototype (this=this@entry=0x7f0ea4ba9e00, builder=builder@entry=0x0, params=params@entry=0x7f0ea4ba9f50)
          at /home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/gcc-10.4.0/include/c++/10.4.0/bits/stl_vector.h:918
      #2  0x0000000001e4df05 in impala::ScalarExpr::CreateIrFunctionPrototype (this=this@entry=0xa90b880, name=..., codegen=codegen@entry=0xaee02c0, args=args@entry=0x7f0ea4ba9f50)
          at /home/quanlong/workspace/Impala/be/src/exprs/scalar-expr.cc:355
      #3  0x0000000001e52fb8 in impala::SlotRef::GetCodegendComputeFnImpl (this=0xa90b880, codegen=0xaee02c0, fn=0x7f0ea4baa280) at /home/quanlong/workspace/Impala/be/src/exprs/slot-ref.cc:197
      #4  0x0000000001e4ccbc in impala::ScalarExpr::GetCodegendComputeFn (this=0xa90b880, codegen=0xaee02c0, is_codegen_entry_point=<optimized out>, fn=fn@entry=0x7f0ea4baa280)
          at /home/quanlong/workspace/Impala/be/src/exprs/scalar-expr.cc:365
      #5  0x00000000014d53e7 in impala::FragmentState::CodegenScalarExprs (this=this@entry=0xa5f08c0) at /home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/boost-1.74.0-p1/include/boost/smart_ptr/scoped_ptr.hpp:109
      #6  0x00000000014d55fe in impala::FragmentState::CodegenHelper (this=0xa5f08c0, event_sequence=0xb044780) at /home/quanlong/workspace/Impala/be/src/runtime/fragment-state.cc:121
      #7  0x00000000014d6229 in impala::FragmentState::InvokeCodegen (this=0xa5f08c0, event_sequence=0xb044780) at /home/quanlong/workspace/Impala/be/src/runtime/fragment-state.cc:94
      #8  0x00000000014d9170 in impala::FragmentInstanceState::Open (this=0xc572560) at /home/quanlong/workspace/Impala/be/src/runtime/fragment-instance-state.cc:417
      #9  0x00000000014db127 in impala::FragmentInstanceState::Exec (this=this@entry=0xc572560) at /home/quanlong/workspace/Impala/be/src/runtime/fragment-instance-state.cc:95
      #10 0x0000000001457f1c in impala::QueryState::ExecFInstance (this=0xaebaa00, fis=0xc572560) at /home/quanlong/workspace/Impala/be/src/runtime/query-state.cc:950
      #11 0x0000000001b07ce9 in boost::function0<void>::operator() (this=0x7f0ea4baac50) at /home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/boost-1.74.0-p1/include/boost/function/function_template.hpp:763
      #12 impala::Thread::SuperviseThread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::function<void ()>, impala::ThreadDebugInfo const*, impala::Promise<long, (impala::PromiseMode)0>*) (name=..., category=..., functor=..., parent_thread_info=0x7f0ea63ad9d0, thread_started=0x7f0ea63ace90)
          at /home/quanlong/workspace/Impala/be/src/util/thread.cc:360
      #13 0x0000000001b08fe1 in boost::_bi::list5<boost::_bi::value<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::_bi::value<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::_bi::value<boost::function<void ()> >, boost::_bi::value<impala::ThreadDebugInfo*>, boost::_bi::value<impala::Promise<long, (impala::PromiseMode)0>*> >::operator()<void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::function<void ()>, impala::ThreadDebugInfo const*, impala::Promise<long, (impala::PromiseMode)0>*), boost::_bi::list0>(boost::_bi::type<void>, void (*&)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::function<void ()>, impala::ThreadDebugInfo const*, impala::Promise<long, (impala::PromiseMode)0>*), boost::_bi::list0&, int) (a=<synthetic pointer>..., 
          f=<error reading variable: Cannot access memory at address 0xc0f95b8>, this=0xc0f95c0) at /home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/boost-1.74.0-p1/include/boost/bind/bind.hpp:531
      #14 boost::_bi::bind_t<void, void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::function<void ()>, impala::ThreadDebugInfo const*, impala::Promise<long, (impala::PromiseMode)0>*), boost::_bi::list5<boost::_bi::value<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::_bi::value<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::_bi::value<boost::function<void ()> >, boost::_bi::value<impala::ThreadDebugInfo*>, boost::_bi::value<impala::Promise<long, (impala::PromiseMode)0>*> > >::operator()() (this=0xc0f95b8) at /home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/boost-1.74.0-p1/include/boost/bind/bind.hpp:1294
      #15 boost::detail::thread_data<boost::_bi::bind_t<void, void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::function<void ()>, impala::ThreadDebugInfo const*, impala::Promise<long, (impala::PromiseMode)0>*), boost::_bi::list5<boost::_bi::value<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::_bi::value<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::_bi::value<boost::function<void ()> >, boost::_bi::value<impala::ThreadDebugInfo*>, boost::_bi::value<impala::Promise<long, (impala::PromiseMode)0>*> > > >::run() (this=0xc0f9480) at /home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/boost-1.74.0-p1/include/boost/thread/detail/thread.hpp:120
      #16 0x0000000002402357 in thread_proxy ()
      #17 0x00007f0fc40b56ba in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
      #18 0x00007f0fc0ff94dd in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      When switching to DEBUG build, it hits a DCHECK on NULL type:

      F1207 15:27:39.059614   336 codegen-anyval.cc:100] 504e849da7d6c423:7154af7e00000003] Check failed: false Unsupported type: NULL
      *** Check failure stack trace: *** 
          @          0x375b04d  google::LogMessage::Fail()
          @          0x375cf84  google::LogMessage::SendToLog()
      F1207 15:27:39.073912   337 codegen-anyval.cc:100] 504e849da7d6c423:7154af7e00000004] Check failed: false Unsupported type: NULL
      *** Check failure stack trace: *** 
          @          0x375aa2c  google::LogMessage::Flush()
          @          0x375d4a9  google::LogMessageFatal::~LogMessageFatal()
          @          0x375b04d  google::LogMessage::Fail()
          @          0x375cf84  google::LogMessage::SendToLog()
          @          0x1907e53  impala::CodegenAnyVal::GetLoweredType()
          @          0x1cac99a  impala::ScalarExpr::CreateIrFunctionPrototype()
          @          0x375aa2c  google::LogMessage::Flush()
          @          0x375d4a9  google::LogMessageFatal::~LogMessageFatal()
          @          0x1cb6391  impala::SlotRef::GetCodegendComputeFnImpl()
          @          0x1907e53  impala::CodegenAnyVal::GetLoweredType()
          @          0x1ca9074  impala::ScalarExpr::GetCodegendComputeFn()
          @          0x13bea98  impala::FragmentState::CodegenScalarExprs()
          @          0x1cac99a  impala::ScalarExpr::CreateIrFunctionPrototype()
          @          0x13bf4d8  impala::FragmentState::CodegenHelper()
          @          0x1cb6391  impala::SlotRef::GetCodegendComputeFnImpl()
          @          0x13bf942  impala::FragmentState::InvokeCodegen()
          @          0x1ca9074  impala::ScalarExpr::GetCodegendComputeFn()
          @          0x13c2857  impala::FragmentInstanceState::Open()
          @          0x13bea98  impala::FragmentState::CodegenScalarExprs()
          @          0x13c7114  impala::FragmentInstanceState::Exec()
          @          0x13bf4d8  impala::FragmentState::CodegenHelper()
          @          0x13345b5  impala::QueryState::ExecFInstance()
          @          0x1334a6f  _ZN5boost6detail8function26void_function_obj_invoker0IZN6impala10QueryState15StartFInstancesEvEUlvE_vE6invokeERNS1_15function_bufferE
          @          0x13bf942  impala::FragmentState::InvokeCodegen()
          @          0x18bd7e2  impala::Thread::SuperviseThread()
          @          0x13c2857  impala::FragmentInstanceState::Open()
          @          0x18be5eb  boost::detail::thread_data<>::run()
          @          0x13c7114  impala::FragmentInstanceState::Exec()
          @          0x2388237  thread_proxy
          @          0x13345b5  impala::QueryState::ExecFInstance()
          @          0x1334a6f  _ZN5boost6detail8function26void_function_obj_invoker0IZN6impala10QueryState15StartFInstancesEvEUlvE_vE6invokeERNS1_15function_bufferE
          @     0x7ff107e446ba  start_thread
          @     0x7ff104d884dd  clone
      Picked up JAVA_TOOL_OPTIONS: -agentlib:jdwp=transport=dt_socket,address=30000,server=y,suspend=n  
          @          0x18bd7e2  impala::Thread::SuperviseThread()
          @          0x18be5eb  boost::detail::thread_data<>::run()
          @          0x2388237  thread_proxy
          @     0x7ff107e446ba  start_thread
          @     0x7ff104d884dd  clone
      Minidump in thread [336]exec-finstance (finst:504e849da7d6c423:7154af7e00000003) running query 504e849da7d6c423:7154af7e00000000, fragment instance 504e849da7d6c423:7154af7e00000003
      Wrote minidump to /home/quanlong/workspace/Impala/logs/cluster/minidumps/impalad/dc3016ba-4a27-4fb3-fbd776b1-2ad85e01.dmp
      

      A code snipper:

        41 llvm::Type* CodegenAnyVal::GetLoweredType(LlvmCodeGen* cg, const ColumnType& type) {
        42   switch (type.type) {
        ...
        99     default:
       100       DCHECK(false) << "Unsupported type: " << type;
       101       return NULL;
       102   }
       103 }
      

      https://github.com/apache/impala/blob/4c772f9c7763541857e26038c3a9cdf0d64e3c0b/be/src/codegen/codegen-anyval.cc#L100

      Attachments

        Issue Links

          Activity

            People

              stigahuang Quanlong Huang
              stigahuang Quanlong Huang
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: