Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] Fix the mem_tracker use-after-free of UDF (backport #41710) #41725

Merged
merged 1 commit into from
Feb 27, 2024

Commits on Feb 27, 2024

  1. [BugFix] Fix the mem_tracker use-after-free of UDF (#41710)

    ## Why I'm doing:
    
    ```
    *** Aborted at 1686120661 (unix time) try "date -d @1686120661" if you are using GNU date ***
    PC: @          0x2ce0b61 starrocks::MemTracker::consume()
    *** SIGSEGV (@0x0) received by PID 117789 (TID 0x7f9cd0728700) from PID 0; stack trace: ***
        @          0x58f9dc2 google::(anonymous namespace)::FailureSignalHandler()
        @     0x7f9d147ae362 (unknown)
        @     0x7f9d147b28b9 JVM_handle_linux_signal
        @     0x7f9d147a5f78 (unknown)
        @     0x7f9d13ce1390 (unknown)
        @          0x2ce0b61 starrocks::MemTracker::consume()
        @          0x486d328 _ZNSt17_Function_handlerIFvvEZN9starrocks24call_function_in_pthreadEPNS1_12RuntimeStateERKSt8functionIFNS1_6StatusEvEEEUlvE_E9_M_invokeERKSt9_Any_data
        @          0x475fbe0 starrocks::PriorityThreadPool::work_thread()
        @          0x58b97e7 thread_proxy
        @     0x7f9d13cd76ba start_thread
        @     0x7f9d132f841d clone
        @                0x0 (unknown)
    ```
    
    After `promise->set_value`, if runtime state of query is first destructed, then release the memory, the mem_tracker has already been free, so it will be crash here.
    
    ## What I'm doing:
    
    Release the mem first, and then set promise value.
    Signed-off-by: trueeyu <lxhhust350@qq.com>
    (cherry picked from commit e36a684)
    trueeyu authored and mergify[bot] committed Feb 27, 2024
    Configuration menu
    Copy the full SHA
    1176cdb View commit details
    Browse the repository at this point in the history