microsoft / cpp_client_telemetry

1DS C++ SDK
Apache License 2.0
87 stars 49 forks source link

Crash on Mac at app teardown at Microsoft::Applications::Events::ILogConfiguration::operator[](char const*) #1063

Open eduardo-camacho opened 2 years ago

eduardo-camacho commented 2 years ago

Office Microsoft AutoUpdate app for Mac uses 1DS snapshot maintained by DIG team (Matt/Sid). An automation testing is randomly testing at lab with following crash log:

Process: mbuunittestapp [26750] Path: /Volumes/VOLUME/*/mbuunittestapp Identifier: mbuunittestapp Version: () Code Type: ARM-64 Parent Process: Python [25479] User ID: 502

Date/Time: 2022-10-14 15:36:07.00 -0700 OS Version: macOS 12.6 (21G115) Report Version: 2 Anonymous UUID: DA6A410D-7034-1F8E-849E-AAFF7D645BC3

Time Awake Since Boot: 110000 seconds

System Integrity Protection: disabled

Crashed Thread: 3

Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: 0x0000000000000001, 0x555555555555558c

Termination Signal: Segmentation fault: 11 Termination Reason: Namespace: SIGNAL, 11 Termination Process: exc handler [26750]

Thread 0: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x1b442ea90 write_nocancel + 8 1 libsystem_c.dylib 0x1b435c5b0 swrite + 23 2 libsystem_c.dylib 0x1b433b444 _swrite + 107 3 libsystem_c.dylib 0x1b433956c sflush + 231 4 libsystem_c.dylib 0x1b433940c fflush + 35 5 libc++.1.dylib 0x1b43d8074 std::1::stdoutbuf::sync() + 179 6 libc++.1.dylib 0x1b43c6324 std::__1::basic_ostream<char, std::1::char_traits >::flush() + 143 7 libc++.1.dylib 0x1b43d73a4 std::__1::DoIOSInit::~DoIOSInit() + 31 8 libsystem_c.dylib 0x1b4353dd0 __cxa_finalize_ranges + 463 9 libsystem_c.dylib 0x1b4353b74 exit + 43 10 libdyld.dylib 0x1b4474ec4 dyld4::LibSystemHelpers::exit(int) const + 19 11 dyld 0x100ffd0d8 start + 595

Thread 1: 0 libsystem_pthread.dylib 0x1b4463078 start_wqthread + 0

Thread 2: 0 libsystem_pthread.dylib 0x1b4463078 start_wqthread + 0

Thread 3: Crashed: 0 MAUUnittests.dylib 0x108d46294 std::1::less<std::1::basic_string<char, std::1::char_traits, std::1::allocator > >::operator()(std::1::basic_string<char, std::1::char_traits, std::1::allocator > const&, std::1::basic_string<char, std::1::char_traits, std::1::allocator > const&) const + 12 1 MAUUnittests.dylib 0x108d46188 std::1::tree_node_base<void>& std::1::tree<std::1::__value_type<std::1::basic_string<char, std::1::char_traits, std::1::allocator >, Microsoft::Applications::Events::Variant>, std::1::map_value_compare<std::1::basic_string<char, std::1::char_traits, std::1::allocator >, std::1::value_type<std::__1::basic_string<char, std::1::char_traits, std::1::allocator >, Microsoft::Applications::Events::Variant>, std::1::less<std::1::basic_string<char, std::__1::char_traits, std::1::allocator > >, true>, std::1::allocator<std::1::value_type<std::__1::basic_string<char, std::1::char_traits, std::1::allocator >, Microsoft::Applications::Events::Variant> > >::find_equal<std::1::basic_string<char, std::__1::char_traits, std::1::allocator > >(std::1::tree_end_node<std::1::tree_node_base<void>>&, std::1::basic_string<char, std::__1::char_traits, std::1::allocator > const&) + 60 2 MAUUnittests.dylib 0x108d46188 std::1::tree_node_base<void>& std::1::tree<std::1::value_type<std::1::basic_string<char, std::__1::char_traits, std::1::allocator >, Microsoft::Applications::Events::Variant>, std::1::map_value_compare<std::1::basic_string<char, std::__1::char_traits, std::1::allocator >, std::1::value_type<std::1::basic_string<char, std::__1::char_traits, std::1::allocator >, Microsoft::Applications::Events::Variant>, std::1::less<std::1::basic_string<char, std::1::char_traits, std::1::allocator > >, true>, std::1::allocator<std::1::value_type<std::1::basic_string<char, std::1::char_traits, std::1::allocator >, Microsoft::Applications::Events::Variant> > >::find_equal<std::1::basic_string<char, std::__1::char_traits, std::1::allocator > >(std::1::tree_end_node<std::1::__tree_node_base<void>>&, std::1::basic_string<char, std::__1::char_traits, std::1::allocator > const&) + 60 3 MAUUnittests.dylib 0x108d46098 std::1::pair<std::1::tree_iterator<std::1::value_type<std::1::basic_string<char, std::1::char_traits, std::1::allocator >, Microsoft::Applications::Events::Variant>, std::1::__tree_node<std::1::value_type<std::__1::basic_string<char, std::1::char_traits, std::1::allocator >, Microsoft::Applications::Events::Variant>, void>, long>, bool> std::1::tree<std::1::value_type<std::__1::basic_string<char, std::1::char_traits, std::1::allocator >, Microsoft::Applications::Events::Variant>, std::1::map_value_compare<std::1::basic_string<char, std::1::char_traits, std::1::allocator >, std::1::__value_type<std::1::basic_string<char, std::1::char_traits, std::1::allocator >, Microsoft::Applications::Events::Variant>, std::1::less<std::__1::basic_string<char, std::1::char_traits, std::1::allocator > >, true>, std::1::allocator<std::1::value_type<std::1::basic_string<char, std::__1::char_traits, std::1::allocator >, Microsoft::Applications::Events::Variant> > >::emplace_unique_key_args<std::__1::basic_string<char, std::1::char_traits, std::1::allocator >, std::1::piecewise_construct_t const&, std::1::tuple<std::1::basic_string<char, std::1::char_traits, std::1::allocator >&&>, std::1::tuple<> >(std::__1::basic_string<char, std::1::char_traits, std::1::allocator > const&, std::1::piecewise_construct_t const&, std::1::tuple<std::1::basic_string<char, std::1::char_traits, std::1::allocator >&&>&&, std::1::tuple<>&&) + 40 4 MAUUnittests.dylib 0x108d4601c Microsoft::Applications::Events::ILogConfiguration::operator[](char const*) + 64 5 MAUUnittests.dylib 0x108d574cc Microsoft::Applications::Events::RuntimeConfig_Default::GetCollectorUrl() + 32 6 MAUUnittests.dylib 0x108d6ad58 Microsoft::Applications::Events::HttpRequestEncoder::handleEncode(std::1::shared_ptr const&) + 172 7 MAUUnittests.dylib 0x108d66b24 void Microsoft::Applications::Events::RouteSource<std::1::shared_ptr const&>::operator()<std::__1::shared_ptr const&>(std::1::shared_ptr const&) const + 56 8 MAUUnittests.dylib 0x108d87568 Microsoft::Applications::Events::Packager::handleFinalizePackage(std::1::shared_ptr const&) + 140 9 MAUUnittests.dylib 0x108d8532c Microsoft::Applications::Events::StorageObserver::handleRetrieveEvents(std::__1::shared_ptr const&) + 196 10 MAUUnittests.dylib 0x108d9c648 Microsoft::Applications::Events::TransmissionPolicyManager::uploadAsync(Microsoft::Applications::Events::EventLatency) + 192 11 MAUUnittests.dylib 0x108d890d4 Microsoft::Applications::Events::PlatformAbstraction::WorkerThread::threadFunc(void) + 324 12 MAUUnittests.dylib 0x108d89618 void std::1::thread_proxy<std::1::tuple<std::1::unique_ptr<std::1::thread_struct, std::__1::default_delete<std::1::__thread_struct> >, void ()(void), void> >(void) + 44 13 libsystem_pthread.dylib 0x1b446826c _pthread_start + 147 14 libsystem_pthread.dylib 0x1b446308c thread_start + 7

Thread 4: 0 libsystem_pthread.dylib 0x1b4463078 start_wqthread + 0

Thread 5: 0 libsystem_pthread.dylib 0x1b4463078 start_wqthread + 0

Thread 6: 0 libsystem_pthread.dylib 0x1b4463078 start_wqthread + 0

Thread 7: Dispatch queue: com.apple.CFNetwork.CacheDB-write 0 com.apple.CoreFoundation 0x1b44d8ccc CFBasicHashAddValue + 1040 1 com.apple.CoreFoundation 0x1b44d8850 CFDictionaryAddValue + 347 2 com.apple.CoreFoundation 0x1b44d8850 CFDictionaryAddValue + 347 3 com.apple.CoreFoundation 0x1b45085bc _flattenPlist + 307 4 com.apple.CoreFoundation 0x1b4508720 _flattenPlist + 663 5 com.apple.CoreFoundation 0x1b4507e80 __CFBinaryPlistWriteOrPresize + 319 6 com.apple.CoreFoundation 0x1b4507aa0 CFPropertyListWrite + 203 7 com.apple.CoreFoundation 0x1b4529684 CFPropertyListCreateData + 143 8 com.apple.CFNetwork 0x1b90cd580 0x1b90bf000 + 58752 9 com.apple.CFNetwork 0x1b90cea1c 0x1b90bf000 + 64028 10 com.apple.CFNetwork 0x1b91d97c0 0x1b90bf000 + 1157056 11 libdispatch.dylib 0x1b42b2fb4 _dispatch_block_async_invoke2 + 147 12 libdispatch.dylib 0x1b42a41b4 _dispatch_client_callout + 19 13 libdispatch.dylib 0x1b42ab8a8 _dispatch_lane_serial_drain + 667 14 libdispatch.dylib 0x1b42ac438 _dispatch_lane_invoke + 443 15 libdispatch.dylib 0x1b42b6c98 _dispatch_workloop_worker_thread + 647 16 libsystem_pthread.dylib 0x1b4464360 _pthread_wqthread + 287 17 libsystem_pthread.dylib 0x1b4463080 start_wqthread + 7

Thread 8: 0 libsystem_kernel.dylib 0x1b442a8b0 mach_msg_trap + 8 1 libsystem_kernel.dylib 0x1b442ad20 mach_msg + 75 2 com.apple.CoreFoundation 0x1b4535210 CFRunLoopServiceMachPort + 371 3 com.apple.CoreFoundation 0x1b45336c0 CFRunLoopRun + 1179 4 com.apple.CoreFoundation 0x1b4532a84 CFRunLoopRunSpecific + 599 5 com.apple.CFNetwork 0x1b932a638 0x1b90bf000 + 2537016 6 com.apple.Foundation 0x1b54105cc NSThreadstart__ + 807 7 libsystem_pthread.dylib 0x1b446826c _pthread_start + 147 8 libsystem_pthread.dylib 0x1b446308c thread_start + 7

Binary Images: 0x1b4429000 - 0x1b4460fff libsystem_kernel.dylib () /usr/lib/system/libsystem_kernel.dylib 0x1b4328000 - 0x1b43a9fff libsystem_c.dylib () /usr/lib/system/libsystem_c.dylib 0x1b43aa000 - 0x1b4410fff libc++.1.dylib () <3d1e6031-901d-3df1-9e9a-f85ff1c2e803> /usr/lib/libc++.1.dylib 0x1b446e000 - 0x1b447afff libdyld.dylib () /usr/lib/system/libdyld.dylib 0x100ff8000 - 0x101057fff dyld () <38ee9fe9-b66d-3066-8c5c-6ddf0d6944c6> /usr/lib/dyld 0x1b4461000 - 0x1b446dfff libsystem_pthread.dylib () <63c4eef9-69a5-38b1-996e-8d31b66a051d> /usr/lib/system/libsystem_pthread.dylib 0x108cb8000 - 0x108df7fff MAUUnittests.dylib () <7243901e-e6b9-3beb-929d-32538dc7cda4> /Volumes/VOLUME//MAUUnittests.dylib 0x1b44b0000 - 0x1b49f6fff com.apple.CoreFoundation (6.9) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation 0x1b90bf000 - 0x1b9573fff com.apple.CFNetwork (1335.0.3) /System/Library/Frameworks/CFNetwork.framework/Versions/A/CFNetwork 0x1b42a0000 - 0x1b42e6fff libdispatch.dylib () /usr/lib/system/libdispatch.dylib 0x1b53b4000 - 0x1b57a5fff com.apple.Foundation (6.9) <8bbf8f9b-0034-34f0-a2c5-13c31941632d> /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation 0x0 - -0x1 ??? () <00000000-0000-0000-0000-000000000000> ???

VM Region Summary: ReadOnly portion of Libraries: Total=791.9M resident=0K(0%) swapped_out_or_unallocated=791.9M(100%) Writable regions: Total=1.2G written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=1.2G(100%)

                            VIRTUAL   REGION 

REGION TYPE SIZE COUNT (non-coalesced) =========== ======= ======= Activity Tracing 256K 1 ColorSync 64K 2 CoreGraphics 16K 1 CoreServices 624K 2 Dispatch continuations 64.0M 1 Kernel Alloc Once 32K 1 MALLOC 1.1G 165 MALLOC guard page 288K 14 Performance tool data 4288K 8 not counted in TOTAL below SQLite page cache 256K 4 STACK GUARD 56.1M 9 Stack 12.2M 9 VM_ALLOCATE 64K 4 AUTH 1861K 155 AUTH_CONST 9511K 307 CTF 756 1 DATA 8582K 297 DATA_CONST 10.0M 312 __DATA_DIRTY 726K 113 FONT_DATA 4K 1 LINKEDIT 580.4M 6 OBJC_CONST 1243K 128 OBJC_RO 83.0M 1 __OBJC_RW 3168K 1 TEXT 211.4M 327 __UNICODE 592K 1 dyld private memory 1024K 1 libnetwork 640K 16 mapped file 50.4M 15 shared memory 848K 12 =========== ======= ======= TOTAL 2.2G 1907

lalitb commented 2 years ago

As discussed in last community meeting, this seems to be scenario where caller having a background thread running as the globals are being torn down. These background threads are still trying to emit events while main thread is tearing down.