title: My program crashes in boost::thread::thread_start_function, how can I debug
body: <p>I've build C++ program using Visual Studio 2008. Both release and debug version are crashing at random times. The frequency of the crashes depends on the machine it runs on (from once a week to every hour).</p>
  
  <p>The program uses boost asio for TCP communication as well as wxWidget for UI. Nevertheless the crashes are not related to any TCP issue or UI interaction as it mostly happens when the program is idle.</p>
  
  <p>Here is the call stack I have when it crashes:</p>
  
  <pre><code>msvcr90d.dll!_NMSG_WRITE(int rterrnum=10)  Line 198 C
  msvcr90d.dll!abort()  Line 59 + 0x7 bytes   C
  msvcr90d.dll!terminate()  Line 130  C++
  enf_client.exe!boost::thread::thread_start_function(void * param=0x00161e60)  Line 184  C++
  msvcr90d.dll!_callthreadstartex()  Line 348 + 0xf bytes C
  msvcr90d.dll!_threadstartex(void * ptd=0x01385d28)  Line 331    C
  kernel32.dll!7c80b729()     
  [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll
  </code></pre>
  
  <p>I am clueless as on how to debug this thing. If you have any idea of where to look for, that would be great.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I have noticed this in my debug trace, just before the crash:</p>
  
  <p><code>First-chance exception at 0x7c812afb in enf_client.exe: Microsoft C++ exception: std::out_of_range at memory location 0x0189efd4..</code></p>
  
  <p>I can not work out what is in memory at this address (looks like a lot of junk):</p>
  
  <p><code>L.H............. ð..0.=..zH. ð...ð.......</code></p>
  
  <p>Which functions can trigger this, beside the <code>at</code> function of stl containers ?</p>