Daniel Becker has uploaded this change for review. ( 
http://gerrit.cloudera.org:8080/20155


Change subject: IMPALA-12260: Crash if '--asm_module_dir' is set
......................................................................

IMPALA-12260: Crash if '--asm_module_dir' is set

If Impala is started with the --asm_module_dir flag set and codegen
cache is used, Impala crashes.

The problem is with the lifetime of 'LlvmCodeGen::symbol_emitter_'. It
is registered as an event listener with the current
'llvm::ExecutionEngine'. Then the engine is cached but the
'LlvmCodeGen' object, which owns the symbol emitter, is destroyed at the
end of the query. When the cached execution engine is destroyed later,
it tries to notify the symbol emitter, but it has already been destroyed
so its pointer is invalid.

This change solves the problem by wrapping the execution engine and the
symbol emitter together in a wrapper class, LlvmExecutionEngineWrapper,
that is responsible for managing their lifetimes. The LlvmCodeGen and
the CodeGenCache classes now hold shared pointers to this wrapper class.
If we add other objects in the future whose lifetimes are tied to the
execution engine (but are not owned by it), they should be put into the
wrapper class.

Testing:
 - added a regression test in tests/custom_cluster/test_codegen_cache.py
   that fails without this change.

Change-Id: I23f871abb962ad317f9c0075ca303c09dd56bcd9
---
M be/src/codegen/llvm-codegen-cache.cc
M be/src/codegen/llvm-codegen-cache.h
M be/src/codegen/llvm-codegen.cc
M be/src/codegen/llvm-codegen.h
A be/src/codegen/llvm-execution-engine-wrapper.h
M tests/custom_cluster/test_codegen_cache.py
6 files changed, 162 insertions(+), 67 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/55/20155/1
--
To view, visit http://gerrit.cloudera.org:8080/20155
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I23f871abb962ad317f9c0075ca303c09dd56bcd9
Gerrit-Change-Number: 20155
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Becker <daniel.bec...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <csringho...@cloudera.com>
Gerrit-Reviewer: Yida Wu <wydbaggio...@gmail.com>

Reply via email to