Tim Armstrong created IMPALA-5891:
-------------------------------------

             Summary: PeriodicCounterUpdater should not rely on static 
initialisation and destruction order
                 Key: IMPALA-5891
                 URL: https://issues.apache.org/jira/browse/IMPALA-5891
             Project: IMPALA
          Issue Type: Bug
          Components: Backend
    Affects Versions: Impala 2.9.0
            Reporter: Tim Armstrong
            Assignee: Tim Armstrong


The lifecycle of PeriodicCounterUpdater is weird and depends on static 
initialisers and destructors running.

Its constructor spawns a thread and its destructor tests down data structures 
in some probably unsafe order.

I've seen a crash in the code which could be caused by the data structures 
being torn down while the thread is still running:
{code}

Thread 1
 0  libpthread-2.12.so + 0xe2e4
    Found by: given as instruction pointer in context
 1  libpthread-2.12.so + 0x9588
    Found by: stack scanning
 2  impalad!google_breakpad::ExceptionHandler::SignalHandler(int, siginfo*, 
void*) + 0x23
    Found by: stack scanning
 3  libjvm.so!os::Linux::chained_handler(int, siginfo*, void*) + 0x112
    Found by: call frame info
 4  libjvm.so!JVM_handle_linux_signal + 0xb6
    Found by: call frame info
 5  libjvm.so!signalHandler(int, siginfo*, void*) + 0x43
    Found by: call frame info
 6  libpthread-2.12.so + 0xf790
    Found by: call frame info
 7  impalad!impala::PeriodicCounterUpdater::UpdateLoop() [function_template.hpp 
: 767 + 0x4]
    Found by: stack scanning
 8  0xffff
    Found by: call frame info
{code}

Instead of the static instance object we should just allocate the state on the 
heap.



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

Reply via email to