[SERVER-40544] tcmalloc cleanup can cause access violation after returning from main() on Windows debug. Created: 09/Apr/19  Updated: 29/Oct/23  Resolved: 16/Apr/19

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.1.11

Type: Bug Priority: Major - P3
Reporter: Henrik Edin Assignee: Henrik Edin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Dev Tools 2019-04-22
Participants:
Linked BF Score: 41

 Description   

Reproducing and creating a full dump using Windows Error Reporting gave the following call stack (no other threads were doing anything):

 	[Inline Frame] storage_wiredtiger_prefixed_record_store_test.exe!std::ctype<char>::widen(char) Line 2566	C++
 	[Inline Frame] storage_wiredtiger_prefixed_record_store_test.exe!std::basic_ios<char,std::char_traits<char> >::widen(char) Line 125	C++
 	[Inline Frame] storage_wiredtiger_prefixed_record_store_test.exe!std::basic_ios<char,std::char_traits<char> >::init(std::basic_streambuf<char,std::char_traits<char> > *) Line 167	C++
 	storage_wiredtiger_prefixed_record_store_test.exe!std::basic_ostream<char,std::char_traits<char> >::basic_ostream<char,std::char_traits<char> >(std::basic_streambuf<char,std::char_traits<char> > * _Strbuf, bool _Isstd) Line 54	C++
 	[Inline Frame] storage_wiredtiger_prefixed_record_store_test.exe!std::basic_ostringstream<char,std::char_traits<char>,std::allocator<char> >::{ctor}(int) Line 568	C++
 	[Inline Frame] storage_wiredtiger_prefixed_record_store_test.exe!std::make_unique() Line 2539	C++
 	storage_wiredtiger_prefixed_record_store_test.exe!mongo::logger::LogstreamBuilder::makeStream() Line 123	C++
 	[Inline Frame] storage_wiredtiger_prefixed_record_store_test.exe!mongo::logger::LogstreamBuilder::stream() Line 113	C++
 	[Inline Frame] storage_wiredtiger_prefixed_record_store_test.exe!mongo::logger::LogstreamBuilder::operator<<(const char *) Line 118	C++
>	storage_wiredtiger_prefixed_record_store_test.exe!mongo::`anonymous namespace'::exceptionFilter(_EXCEPTION_POINTERS * excPointers) Line 138	C++
 	KERNELBASE.dll!UnhandledExceptionFilter()	Unknown
 	ntdll.dll!RtlUserThreadStart$filt$0()	Unknown
 	ntdll.dll!__C_specific_handler()	Unknown
 	ntdll.dll!RtlpExecuteHandlerForException()	Unknown
 	ntdll.dll!RtlDispatchException()	Unknown
 	ntdll.dll!KiUserExceptionDispatch()	Unknown
 	ntdll.dll!RtlpWaitOnCriticalSection()	Unknown
 	ntdll.dll!RtlpEnterCriticalSectionContended()	Unknown
 	ntdll.dll!RtlEnterCriticalSection()	Unknown
 	storage_wiredtiger_prefixed_record_store_test.exe!_Mtxlock(_RTL_CRITICAL_SECTION * _Mtx) Line 24	C
 	storage_wiredtiger_prefixed_record_store_test.exe!std::_Lockit::_Lockit(int kind) Line 69	C++
 	[Inline Frame] storage_wiredtiger_prefixed_record_store_test.exe!std::_Iterator_base12::_Adopt(const std::_Container_base12 * _Parent) Line 162	C++
 	[Inline Frame] storage_wiredtiger_prefixed_record_store_test.exe!std::_Iterator_base12::operator=(const std::_Iterator_base12 &) Line 131	C++
 	[Inline Frame] storage_wiredtiger_prefixed_record_store_test.exe!std::_Iterator_base12::{ctor}(const std::_Iterator_base12 &) Line 115	C++
 	[Inline Frame] storage_wiredtiger_prefixed_record_store_test.exe!tcmalloc::Span::ExtractSpanSetIterator() Line 142	C++
 	storage_wiredtiger_prefixed_record_store_test.exe!tcmalloc::PageHeap::RemoveFromFreeList(tcmalloc::Span * span) Line 435	C++
 	storage_wiredtiger_prefixed_record_store_test.exe!tcmalloc::PageHeap::CheckAndHandlePreMerge(tcmalloc::Span * span, tcmalloc::Span * other) Line 341	C++
 	storage_wiredtiger_prefixed_record_store_test.exe!tcmalloc::PageHeap::MergeIntoFreeList(tcmalloc::Span * span) Line 384	C++
 	storage_wiredtiger_prefixed_record_store_test.exe!tcmalloc::PageHeap::Delete(tcmalloc::Span * span) Line 314	C++
 	[Inline Frame] storage_wiredtiger_prefixed_record_store_test.exe!tcmalloc::CentralFreeList::ReleaseToSpans(void *) Line 142	C++
 	storage_wiredtiger_prefixed_record_store_test.exe!tcmalloc::CentralFreeList::ReleaseListToSpans(void * start) Line 85	C++
 	storage_wiredtiger_prefixed_record_store_test.exe!tcmalloc::CentralFreeList::InsertRange(void * start, void * end, int N) Line 243	C++
 	[Inline Frame] storage_wiredtiger_prefixed_record_store_test.exe!tcmalloc::ThreadCache::ReleaseToCentralCache(tcmalloc::ThreadCache::FreeList * src, unsigned int N, int) Line 207	C++
 	storage_wiredtiger_prefixed_record_store_test.exe!tcmalloc::ThreadCache::Cleanup() Line 110	C++
 	storage_wiredtiger_prefixed_record_store_test.exe!tcmalloc::ThreadCache::DeleteCache(tcmalloc::ThreadCache * heap) Line 473	C++
 	storage_wiredtiger_prefixed_record_store_test.exe!on_process_term() Line 138	C++
 	storage_wiredtiger_prefixed_record_store_test.exe!_initterm(void(*)() * first, void(*)() * last) Line 22	C++
 	storage_wiredtiger_prefixed_record_store_test.exe!common_exit::__l2::<lambda>() Line 251	C++
 	storage_wiredtiger_prefixed_record_store_test.exe!__crt_seh_guarded_call<void>::operator()<void <lambda>(void),void <lambda>(void) & __ptr64,void <lambda>(void) >(__acrt_lock_and_call::__l2::void <lambda>(void) && setup, common_exit::__l2::void <lambda>(void) & action, __acrt_lock_and_call::__l2::void <lambda>(void) && cleanup) Line 224	C++
 	storage_wiredtiger_prefixed_record_store_test.exe!__acrt_lock_and_call<void <lambda>(void) >(const __acrt_lock_id lock_id, common_exit::__l2::void <lambda>(void) && action) Line 961	C++
 	storage_wiredtiger_prefixed_record_store_test.exe!common_exit(const int return_code, const _crt_exit_cleanup_mode cleanup_mode, const _crt_exit_return_mode return_mode) Line 259	C++
 	storage_wiredtiger_prefixed_record_store_test.exe!exit(int return_code) Line 294	C++
 	storage_wiredtiger_prefixed_record_store_test.exe!__scrt_common_main_seh() Line 297	C++
 	storage_wiredtiger_prefixed_record_store_test.exe!__scrt_common_main() Line 331	C++
 	storage_wiredtiger_prefixed_record_store_test.exe!mainCRTStartup() Line 17	C++
 	kernel32.dll!BaseThreadInitThunk()	Unknown
 	ntdll.dll!RtlUserThreadStart()	Unknown



 Comments   
Comment by Githook User [ 16/Apr/19 ]

Author:

{'name': 'Henrik Edin', 'username': 'henrikedin', 'email': 'henrik.edin@mongodb.com'}

Message: SERVER-40544 Disable injection of on_process_term() at process exit
Branch: master
https://github.com/mongodb/mongo/commit/06149a310d2b5604b4db4dfc1a8c89353e227d9c

Generated at Thu Feb 08 04:55:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.