Boost logo

Boost Users :

Subject: [Boost-users] boost::thread issue
From: danielsabin_at_[hidden]
Date: 2008-12-05 17:22:40


Hi,

I started working on a project a couple of months ago and i decided to use boost::thread. I like the library, very nicely done and easy to use - great job.
However, I ran into an issue and although i have already spent a significant amount of time trying to figure it out, I was not able to make any progress so far.
 
The project is written in pure C++ (no managed code) on Windows XP/SP3.
I am using Visual Studio 2005 with SP1 as the C++ compiler.
I am using the pre-built binaries for boost 1_36_0 provided by boost consulting.

My main program simply creates several boost::thread objects which do various things.
Everything works fine except for one thing: occasionally when I start the program I receive the following error:
"The exception unknown software exception (0xc0000409) occurred in the application at location 0x00421cd3".
In general exception 0xc0000409 means that the system detected (or thinks it detected) an overrun of a stack-based buffer.
The code is compiled with the /GS switch (Buffer security check) enabled.

The debug stack trace when the exception is thrown shows 2 threads, the exception being thrown by thread2, as follows:

(thread 1) 5752 __tmainCRTStartup __CxxSetUnhandledExceptionFilter Normal 0
        ---------------------------------------------------------------------------------
         ntdll.dll!_KiFastSystemCallRet_at_0()
         ntdll.dll!_ZwWaitForSingleObject_at_12() + 0xc bytes
         ntdll.dll!_RtlpWaitForCriticalSection_at_4() + 0x8c bytes
         ntdll.dll!_RtlEnterCriticalSection_at_4() + 0x46 bytes
         ntdll.dll!_LdrLockLoaderLock_at_12() + 0x6b bytes
         kernel32.dll!7c80b43f()
         [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
         ntdll.dll!_ZwQueryVirtualMemory_at_24() + 0xc bytes
         kernel32.dll!7c80b9ed()
         kernel32.dll!7c8638bd()
         kernel32.dll!7c8449b0()
         ntdll.dll!_RtlpAllocateFromHeapLookaside_at_4() + 0x31 bytes
         kernel32.dll!7c80262a()
         ntdll.dll!_NtQueryInformationProcess_at_20() + 0xc bytes
         msvcr80.dll!7814a84c()
         MyService.exe!__CxxSetUnhandledExceptionFilter() Line 90 C++
         msvcr80.dll!78131762()
> MyService.exe!__tmainCRTStartup() Line 494 + 0xf bytes C
         kernel32.dll!7c817007()
         ntdll.dll!_RtlpAllocateFromHeapLookaside_at_4() + 0x31 bytes

(thread 2) 7976 __report_gsfailure __report_gsfailure Time Critical 0
        -------------------------------------------------------------------------
         MyService.exe!__crt_debugger_hook() Unknown
> MyService.exe!__report_gsfailure() Line 298 + 0x7 bytes C
         MyService.exe!boost::detail::create_once_mutex() + 0x63 bytes C++
         MyService.exe!boost::call_once<void (*)(void)>() + 0x36 bytes C++
         MyService.exe!boost::`anonymous namespace'::run_thread_exit_callbacks() + 0x34 bytes C++
         MyService.exe!boost::thread::interrupt() + 0xdc bytes C++
         ntdll.dll!_LdrpCallInitRoutine_at_16() + 0x14 bytes
         ntdll.dll!_LdrpCallTlsInitializers_at_8() + 0x12fad bytes
         ntdll.dll!_LdrShutdownThread_at_0() + 0xf4ae bytes
         kernel32.dll!7c80c0c6()
         [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
         csauser.dll!10103b7f()
         kernel32.dll!7c80b6b9()

Since I did not get too far on my own I really need your help. Did anybody else run into anything similar or does anybody have any idea about how to debug this?

Thanks,

--daniel


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net