Boost C++ Libraries: Ticket #768: Crash on exit VC8.0 https://svn.boost.org/trac10/ticket/768 <pre class="wiki">Hi I get a crash on exit of my application: when examining the stack as show below I conclude that the crash heppens in the cleanup of some static objects in the boost::regex i.e. the destructor of w32_regex_traits_implementation. This happens in release build on VC8.0 with 1.33.1. Was there a patch for this? Thankx for feedback, Kenny Knecht pietjeleugenaar@hotmail.com kernel32.dll!7c812a5b() [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll] kernel32.dll!7c812a5b() msvcp80.dll!std::char_traits&lt;char&gt;::_Copy_s(char * _First1=0x09fd8490, unsigned int _Size_in_bytes=31, const char * _First2=0x7c423995, unsigned int _Count=27) Line 576 C++ msvcp80.dll!std::basic_string&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt; &gt;::assign(const std::basic_string&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt; &gt; &amp; _Right={...}, unsigned int _Roff=1244628, unsigned int _Count=3765269347) Line 1021 + 0x2c bytes C++ 00000001() GeneMathsXT.exe!std::_Tree&lt;std::_Tmap_traits&lt;std::basic_string&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt; &gt;,std::basic_string&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt; &gt;,std::less&lt;std::basic_string&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt; &gt; &gt;,std::allocator&lt;std::pair&lt;std::basic_string&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt; &gt; const ,std::basic_string&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt; &gt; &gt; &gt;,0&gt; &gt;::erase() + 0x73 bytes C++ GeneMathsXT.exe!std::_Tree&lt;std::_Tmap_traits&lt;std::basic_string&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt; &gt;,std::basic_string&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt; &gt;,std::less&lt;std::basic_string&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt; &gt; &gt;,std::allocator&lt;std::pair&lt;std::basic_string&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt; &gt; const ,std::basic_string&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt; &gt; &gt; &gt;,0&gt; &gt;::erase() + 0xa4 bytes C++ GeneMathsXT.exe!boost::re_detail::w32_regex_traits_implementation&lt;char&gt;::~w32_regex_traits_implementation&lt;char&gt;() + 0x52 bytes C++ GeneMathsXT.exe!boost::detail::sp_counted_impl_p&lt;boost::re_detail::w32_regex_traits_implementation&lt;char&gt; &gt;::dispose() + 0xf bytes C++ GeneMathsXT.exe!std::list&lt;std::pair&lt;boost::shared_ptr&lt;boost::re_detail::w32_regex_traits_implementation&lt;char&gt; &gt;,unsigned long const *&gt;,std::allocator&lt;std::pair&lt;boost::shared_ptr&lt;boost::re_detail::w32_regex_traits_implementation&lt;char&gt; &gt;,unsigned long const *&gt; &gt; &gt;::clear() + 0x3e bytes C++ GeneMathsXT.exe!boost::object_cache&lt;unsigned long,boost::re_detail::w32_regex_traits_implementation&lt;char&gt; &gt;::data::~data() + 0x6b bytes C++ &gt; msvcr80.dll!doexit(int code=0, int quick=0, int retcaller=0) Line 553 C msvcr80.dll!exit(int code=0) Line 398 + 0xd bytes C GeneMathsXT.exe!__tmainCRTStartup() Line 549 C kernel32.dll!7c816fd7() </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/768 Trac 1.4.3 John Maddock Fri, 03 Nov 2006 16:48:47 GMT <link>https://svn.boost.org/trac10/ticket/768#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/768#comment:1</guid> <description> <pre class="wiki">Logged In: YES user_id=14804 This works for me: I've just double checked by building and running the regression test programs in release mode and everything checks out OK. So, can check that you don't have _DEBUG defined when building with /MT or /MD (it'll cause you to link against the wrong regex lib variant otherwise). Then if you still have a problem please provide more information: What runtime options are you using, /MT or /MD? Are you using the static or dll regex version? And if possible please provide a small VC++ project that reproduces the issue. Regards, John Maddock. </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>nobody</dc:creator> <pubDate>Mon, 06 Nov 2006 16:17:41 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/768#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/768#comment:2</guid> <description> <pre class="wiki">Logged In: NO Hi John, I have been testing all day, but can't seem to find out what goes wrong: all I know is that if I don't call any boost::regex function everything goes all right otherwise I get a crash while cleaning up the static objects. I haven't changed the default settings so I guess the dll loads statically. In debug every works fine. I guess if I were overwriting memory in my own code that would fail as well, but this is not entirely impossible of course. I tried to enable BOOST_SP_ENABLE_DEBUG_HOOKS but I cannot delete anything from the memory then... These are the settings I use in VC8.0 compiler: /Od /I "C:\Boost\include\boost-1_33_1" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "TESTRELEASE" /D "_VC80_UPGRADE=0x0710" /D "_AFXDLL" /D "_MBCS" /FD /EHsc /RTC1 /MDd /Yu"stdafx.h" /Fp".\Debug/pWindows.pch" /Fo".\Debug/" /Fd".\Debug/" /FR".\Debug\\" /W3 /nologo /c /Zi /TP /errorReport:prompt linker: /OUT:".\Debug/pWindows.exe" /INCREMENTAL /NOLOGO /MANIFEST /MANIFESTFILE:".\Debug\ProtoGMWindows.exe.intermediate.manifest" /DEBUG /PDB:".\Debug/pWindows.pdb" /SUBSYSTEM:WINDOWS /ERRORREPORT:PROMPT opengl32.lib glu32.lib glaux.lib gdiplus.lib Thanks for your feedback! kenny </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Sun, 12 Nov 2006 16:56:19 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/768#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/768#comment:3</guid> <description> <pre class="wiki">Logged In: YES user_id=14804 The project settings you give there are for a debug build, not a release build. Can you try and reproduce the issue with one of the sample regex programs and send me your IDE project files if you get a test case? Thanks, John. </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>sf-robot</dc:creator> <pubDate>Mon, 27 Nov 2006 03:20:04 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/768#comment:4 https://svn.boost.org/trac10/ticket/768#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> <pre class="wiki">Logged In: YES user_id=1312539 Originator: NO This Tracker item was closed automatically by the system. It was previously set to a Pending status, and the original submitter did not respond within 14 days (the time period specified by the administrator of this Tracker). </pre> Ticket anonymous Mon, 28 Apr 2008 02:11:05 GMT <link>https://svn.boost.org/trac10/ticket/768#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/768#comment:5</guid> <description> <p> After long investigation with the same problem (crash on program exit when actually using regex) I found that the problem is caused by mixing up the VC++ 2005 versions: the library was compiled with VC++ 2005 without SP1 and the program was compiled with VC++ 2005 with SP1. When I compiled the library with VC++ 2005 with SP1 the problem was gone. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Mon, 28 Apr 2008 09:24:52 GMT</pubDate> <title>description changed; severity set https://svn.boost.org/trac10/ticket/768#comment:6 https://svn.boost.org/trac10/ticket/768#comment:6 <ul> <li><strong>description</strong> modified (<a href="/trac10/ticket/768?action=diff&amp;version=6">diff</a>) </li> <li><strong>severity</strong> → <span class="trac-field-new">Showstopper</span> </li> </ul> <p> Ahah! Yes mixing compiler versions would certainly do it, glad you got to the bottom of this! </p> <p> John. </p> Ticket anonymous Thu, 08 May 2008 07:20:40 GMT <link>https://svn.boost.org/trac10/ticket/768#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/768#comment:7</guid> <description> <p> I encountered the exact same crashes and after some investigation I discovered that checked iterators were turned off in our project, but on (the default) for the regex library. I built the library again with _SECURE_SCL=0 and indeed, the crashes disappeared. </p> </description> <category>Ticket</category> </item> </channel> </rss>