Opened 16 years ago

Closed 16 years ago

Last modified 14 years ago

#768 closed Bugs (None)

Crash on exit VC8.0

Reported by: nobody Owned by: John Maddock
Milestone: Component: regex
Version: None Severity: Showstopper
Keywords: Cc:

Description (last modified by John Maddock)

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<char>::_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<char,std::char_traits<char>,std::allocator<char>
>::assign(const
std::basic_string<char,std::char_traits<char>,std::allocator<char>
> & _Right={...}, unsigned int _Roff=1244628, unsigned
int _Count=3765269347)  Line 1021 + 0x2c bytes	C++
 	00000001()	
 
GeneMathsXT.exe!std::_Tree<std::_Tmap_traits<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>
>,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const
,std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > >,0> >::erase()  + 0x73 bytes	C++
 
GeneMathsXT.exe!std::_Tree<std::_Tmap_traits<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>
>,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const
,std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > >,0> >::erase()  + 0xa4 bytes	C++
 
GeneMathsXT.exe!boost::re_detail::w32_regex_traits_implementation<char>::~w32_regex_traits_implementation<char>()
 + 0x52 bytes	C++
 
GeneMathsXT.exe!boost::detail::sp_counted_impl_p<boost::re_detail::w32_regex_traits_implementation<char>
>::dispose()  + 0xf bytes	C++
 
GeneMathsXT.exe!std::list<std::pair<boost::shared_ptr<boost::re_detail::w32_regex_traits_implementation<char>
>,unsigned long const
*>,std::allocator<std::pair<boost::shared_ptr<boost::re_detail::w32_regex_traits_implementation<char>
>,unsigned long const *> > >::clear()  + 0x3e bytes	C++
 	GeneMathsXT.exe!boost::object_cache<unsigned
long,boost::re_detail::w32_regex_traits_implementation<char>
>::data::~data()  + 0x6b bytes	C++
>	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() 	

Change History (7)

comment:1 by John Maddock, 16 years ago

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.

comment:2 by nobody, 16 years ago

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

comment:3 by John Maddock, 16 years ago

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.

comment:4 by sf-robot, 16 years ago

Status: assignedclosed
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).

comment:5 by anonymous, 14 years ago

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.

comment:6 by John Maddock, 14 years ago

Description: modified (diff)
Severity: Showstopper

Ahah! Yes mixing compiler versions would certainly do it, glad you got to the bottom of this!

John.

comment:7 by anonymous, 14 years ago

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.

Note: See TracTickets for help on using tickets.