[LLVMbugs] [Bug 21621] New: Race condition in ASAN with detached threads.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Nov 20 14:58:58 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=21621

            Bug ID: 21621
           Summary: Race condition in ASAN with detached threads.
           Product: compiler-rt
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: compiler-rt
          Assignee: unassignedbugs at nondot.org
          Reporter: eric at efcs.ca
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

There seems to be a race condition between when ASAN checks for leaks and when
detached threads exit and free their resources. For example the below test
detects a leak with both libc++ and libstdc++. However when the main thread
waits for the spawned thread to exit no leak is detected.

// clang++ -std=c++11 -fsanitize=address -lpthread test.cpp
#include <thread>
#include <chrono>

void func()
{
    std::this_thread::sleep_for(std::chrono::milliseconds(500));
}

int main() {
    std::thread(func).detach();
    // Enable to see ASAN pass.
    //std::this_thread::sleep_for(std::chrono::milliseconds(600));
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141120/7dc3d0ed/attachment.html>


More information about the llvm-bugs mailing list