Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash related to GC: help interpreting stacktrace #97661

Closed
rolfbjarne opened this issue Jan 29, 2024 · 9 comments
Closed

Crash related to GC: help interpreting stacktrace #97661

rolfbjarne opened this issue Jan 29, 2024 · 9 comments

Comments

@rolfbjarne
Copy link
Member

From @charlesroddie on Mon, 29 Jan 2024 17:25:32 GMT

Our NativeAOT-compiled ios app crashes after a certain period of time from one of the pages, with a crash report indicating GC issues. We would like help on how to diagnose this. We understand very little of it beyond the fact that System.Linq is involved (we use almost no System.Linq but we use realm which uses it) and GC. Is there any other info we should be getting?

Steps to Reproduce

Get the Summatic IOS app from testflight or the Store. Navigate to a question. Wait 20-30mins.

Expected Behavior

Nothing happens

Actual Behavior

The app crashes. This crash is not registered on AppCenter and does not trigger Runtime.MarshalManagedException or Runtime.MarshalObjectiveCException or AppDomain.CurrentDomain.UnhandledException or TaskScheduler.UnobservedTaskException. There is a crash report on Testflight, attached below.

Environment

Version information
Azure pipelines macos-13 image version 
Xcode_15.2.app
dotnet 8.0.100

Build Logs

Available if useful

Symbolicated crash report

Incident Identifier: 63B21B2A-747E-4906-AFA3-F29386F3B088
Hardware Model:      iPad12,1
Process:             50iOS [7014]
Path:                /private/var/containers/Bundle/Application/056E6B9D-D530-472A-B492-22AC465667AD/50iOS.app/50iOS
Identifier:          com.summatic.ios
Version:             2.16.11 (1706536244)
AppStoreTools:       15C5500a
AppVariant:          1:iPad12,1:17
Beta:                YES
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           com.summatic.ios [567]

Date/Time:           2024-01-29 14:23:03.9926 +0000
Launch Time:         2024-01-29 14:12:57.1397 +0000
OS Version:          iPhone OS 17.2 (21C62)
Release Type:        User
Report Version:      104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_PROTECTION_FAILURE at 0x000000016f5b7e98
Exception Codes: 0x0000000000000002, 0x000000016f5b7e98
VM Region Info: 0x16f5b7e98 is in 0x16f5b4000-0x16f5b8000;  bytes after start: 16024  bytes before end: 359
      REGION TYPE                 START - END      [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      MALLOC_TINY              13b600000-13b700000 [ 1024K] rw-/rwx SM=PRV  
      GAP OF 0x33eb4000 BYTES
--->  STACK GUARD              16f5b4000-16f5b8000 [   16K] ---/rwx SM=NUL  ... for thread 0
      Stack                    16f5b8000-16f6b4000 [ 1008K] rw-/rwx SM=SHM  thread 0
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [7014]

Triggered by Thread:  0




Thread 0 Crashed:
0   libsystem_kernel.dylib          0x00000001fb856398 thread_get_state + 52 (thread_actUser.c:727)
1   libsystem_kernel.dylib          0x00000001fb865568 thread_get_register_pointer_values + 132 (thread_register_state.c:63)
2   50iOS                           0x00000001008b355c GCToOSInterface::FlushProcessWriteBuffers() + 140 (gcenv.unix.cpp:456)
3   50iOS                           0x00000001008688fc ThreadStore::SuspendAllThreads(bool) + 128 (threadstore.cpp:264)
4   50iOS                           0x0000000100861cac GCToEEInterface::SuspendEE(SUSPEND_REASON) + 128 (gcrhenv.cpp:591)
5   50iOS                           0x000000010087c1f4 WKS::GCHeap::GarbageCollectGeneration(unsigned int, gc_reason) + 696 (gc.cpp:50492)
6   50iOS                           0x000000010087e4e4 WKS::gc_heap::try_allocate_more_space(alloc_context*, unsigned long, unsigned int, int) + 964 (gc.cpp:19049)
7   50iOS                           0x00000001008a28e0 WKS::GCHeap::Alloc(gc_alloc_context*, unsigned long, unsigned int) + 256 (gc.cpp:49460)
8   50iOS                           0x00000001008617f8 RhpGcAlloc + 256 (gcrhenv.cpp:251)
9   50iOS                           0x00000001008bfe90 RhpNewObject + 60
10  50iOS                           0x000000010213ee08 fram0_System_Linq_System_Linq_Enumerable_Concat2Iterator_1<System___Canon>__Clone + 40
11  50iOS                           0x000000010213f5f8 fram0_System_Linq_System_Linq_Enumerable_Iterator_1<System___Canon>__GetEnumerator + 56
12  50iOS                           0x000000010213f22c fram0_System_Linq_System_Linq_Enumerable_ConcatIterator_1<System___Canon>__MoveNext + 76
13  50iOS                           0x000000010213f264 fram0_System_Linq_System_Linq_Enumerable_ConcatIterator_1<System___Canon>__MoveNext + 132

Thread 1:
0   libsystem_kernel.dylib          0x00000001fb851b1c __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib         0x000000021e07afd4 _pthread_cond_wait + 1228 (pthread_cond.c:862)
2   50iOS                           0x00000001008b2fe8 UnixEvent::Wait(unsigned int) + 232 (PalRedhawkUnix.cpp:272)
3   50iOS                           0x000000010085fbf8 RhpWaitForFinalizerRequest + 52 (FinalizerHelpers.cpp:148)
4   50iOS                           0x0000000100c1f3d0 S_P_CoreLib_System_Runtime___Finalizer__ProcessFinalizers + 48
5   50iOS                           0x000000010085fac4 FinalizerStart(void*) + 88 (FinalizerHelpers.cpp:67)
6   libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
7   libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 2:
0   libsystem_kernel.dylib          0x00000001fb851178 mach_msg2_trap + 8 (:-1)
1   libsystem_kernel.dylib          0x00000001fb850f10 mach_msg2_internal + 80 (mach_msg.c:201)
2   libsystem_kernel.dylib          0x00000001fb850e28 mach_msg_overwrite + 436 (mach_msg.c:0)
3   libsystem_kernel.dylib          0x00000001fb850c68 mach_msg + 24 (mach_msg.c:323)
4   CoreFoundation                  0x00000001b41b7b1c __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2624)
5   CoreFoundation                  0x00000001b41b5a14 __CFRunLoopRun + 1208 (CFRunLoop.c:3007)
6   CoreFoundation                  0x00000001b41b5478 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)
7   Foundation                      0x00000001b314848c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 (NSRunLoop.m:373)
8   Foundation                      0x00000001b317574c -[NSRunLoop(NSRunLoop) runUntilDate:] + 64 (NSRunLoop.m:420)
9   UIKitCore                       0x00000001b653b4a8 -[UIEventFetcher threadMain] + 420 (UIEventFetcher.m:1208)
10  Foundation                      0x00000001b31cbde0 __NSThread__start__ + 732 (NSThread.m:991)
11  libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
12  libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 3:
0   libsystem_kernel.dylib          0x00000001fb851b1c __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib         0x000000021e07b000 _pthread_cond_wait + 1272 (pthread_cond.c:862)
2   50iOS                           0x00000001008cac68 SystemNative_LowLevelMonitor_TimedWait + 104 (pal_threading.c:201)
3   50iOS                           0x0000000100c7510c fram0_S_P_CoreLib_System_Threading_WaitSubsystem_ThreadWaitInfo__Wait + 524
4   50iOS                           0x0000000100c759e8 fram0_S_P_CoreLib_System_Threading_WaitSubsystem_WaitableObject__Wait + 168
5   50iOS                           0x0000000100be1734 fram0_S_P_CoreLib_System_Threading_WaitHandle__WaitOneNoCheck + 228
6   50iOS                           0x0000000100be1628 fram0_S_P_CoreLib_System_Threading_WaitHandle__WaitOne + 24
7   50iOS                           0x0000000100c72768 fram0_S_P_CoreLib_System_Threading_PortableThreadPool_GateThread__GateThreadStart + 360
8   50iOS                           0x0000000100bd5a70 fram0_S_P_CoreLib_System_Threading_Thread__StartThread + 400
9   50iOS                           0x0000000100bd5fe0 fram0_S_P_CoreLib_System_Threading_Thread__ThreadEntryPoint + 32
10  libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
11  libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 4:
0   libsystem_kernel.dylib          0x00000001fb851b1c __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib         0x000000021e07b000 _pthread_cond_wait + 1272 (pthread_cond.c:862)
2   50iOS                           0x00000001008cac68 SystemNative_LowLevelMonitor_TimedWait + 104 (pal_threading.c:201)
3   50iOS                           0x0000000100c7510c fram0_S_P_CoreLib_System_Threading_WaitSubsystem_ThreadWaitInfo__Wait + 524
4   50iOS                           0x0000000100c759e8 fram0_S_P_CoreLib_System_Threading_WaitSubsystem_WaitableObject__Wait + 168
5   50iOS                           0x0000000100bd6810 fram0_S_P_CoreLib_System_Threading_LowLevelLifoSemaphore__WaitForSignal + 144
6   50iOS                           0x0000000100bd675c fram0_S_P_CoreLib_System_Threading_LowLevelLifoSemaphore__Wait + 476
7   50iOS                           0x0000000100c74464 fram0_S_P_CoreLib_System_Threading_PortableThreadPool_WorkerThread__WorkerThreadStart + 548
8   50iOS                           0x0000000100bd5a70 fram0_S_P_CoreLib_System_Threading_Thread__StartThread + 400
9   50iOS                           0x0000000100bd5fe0 fram0_S_P_CoreLib_System_Threading_Thread__ThreadEntryPoint + 32
10  libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
11  libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 5:
0   libsystem_kernel.dylib          0x00000001fb851b1c __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib         0x000000021e07b000 _pthread_cond_wait + 1272 (pthread_cond.c:862)
2   50iOS                           0x00000001008cac68 SystemNative_LowLevelMonitor_TimedWait + 104 (pal_threading.c:201)
3   50iOS                           0x0000000100c7510c fram0_S_P_CoreLib_System_Threading_WaitSubsystem_ThreadWaitInfo__Wait + 524
4   50iOS                           0x0000000100c759e8 fram0_S_P_CoreLib_System_Threading_WaitSubsystem_WaitableObject__Wait + 168
5   50iOS                           0x0000000100be1734 fram0_S_P_CoreLib_System_Threading_WaitHandle__WaitOneNoCheck + 228
6   50iOS                           0x0000000100be1628 fram0_S_P_CoreLib_System_Threading_WaitHandle__WaitOne + 24
7   50iOS                           0x0000000100be0444 fram0_S_P_CoreLib_System_Threading_TimerQueue__TimerThread + 132
8   50iOS                           0x0000000100bd5a70 fram0_S_P_CoreLib_System_Threading_Thread__StartThread + 400
9   50iOS                           0x0000000100bd5fe0 fram0_S_P_CoreLib_System_Threading_Thread__ThreadEntryPoint + 32
10  libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
11  libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 6:
0   libsystem_kernel.dylib          0x00000001fb851178 mach_msg2_trap + 8 (:-1)
1   libsystem_kernel.dylib          0x00000001fb850f10 mach_msg2_internal + 80 (mach_msg.c:201)
2   libsystem_kernel.dylib          0x00000001fb850e28 mach_msg_overwrite + 436 (mach_msg.c:0)
3   libsystem_kernel.dylib          0x00000001fb850c68 mach_msg + 24 (mach_msg.c:323)
4   CoreFoundation                  0x00000001b41b7b1c __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2624)
5   CoreFoundation                  0x00000001b41b5a14 __CFRunLoopRun + 1208 (CFRunLoop.c:3007)
6   CoreFoundation                  0x00000001b41b5478 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)
7   CFNetwork                       0x00000001b54b3060 +[__CFN_CoreSchedulingSetRunnable _run:] + 384 (CoreSchedulingSet.mm:1479)
8   Foundation                      0x00000001b31cbde0 __NSThread__start__ + 732 (NSThread.m:991)
9   libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
10  libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 7:
0   libsystem_pthread.dylib         0x000000021e07b9fc start_wqthread + 0 (:-1)

Thread 8:
0   libsystem_pthread.dylib         0x000000021e07b9fc start_wqthread + 0 (:-1)

Thread 9:
0   libsystem_pthread.dylib         0x000000021e07b9fc start_wqthread + 0 (:-1)

Thread 10:
0   libsystem_pthread.dylib         0x000000021e07b9fc start_wqthread + 0 (:-1)

Thread 11:
0   libsystem_kernel.dylib          0x00000001fb851b1c __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib         0x000000021e07b000 _pthread_cond_wait + 1272 (pthread_cond.c:862)
2   50iOS                           0x00000001008cac68 SystemNative_LowLevelMonitor_TimedWait + 104 (pal_threading.c:201)
3   50iOS                           0x0000000100c7510c fram0_S_P_CoreLib_System_Threading_WaitSubsystem_ThreadWaitInfo__Wait + 524
4   50iOS                           0x0000000100c759e8 fram0_S_P_CoreLib_System_Threading_WaitSubsystem_WaitableObject__Wait + 168
5   50iOS                           0x0000000100bd6810 fram0_S_P_CoreLib_System_Threading_LowLevelLifoSemaphore__WaitForSignal + 144
6   50iOS                           0x0000000100bd675c fram0_S_P_CoreLib_System_Threading_LowLevelLifoSemaphore__Wait + 476
7   50iOS                           0x0000000100c74464 fram0_S_P_CoreLib_System_Threading_PortableThreadPool_WorkerThread__WorkerThreadStart + 548
8   50iOS                           0x0000000100bd5a70 fram0_S_P_CoreLib_System_Threading_Thread__StartThread + 400
9   50iOS                           0x0000000100bd5fe0 fram0_S_P_CoreLib_System_Threading_Thread__ThreadEntryPoint + 32
10  libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
11  libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 12:
0   libsystem_kernel.dylib          0x00000001fb851b1c __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib         0x000000021e07b000 _pthread_cond_wait + 1272 (pthread_cond.c:862)
2   50iOS                           0x00000001008b43d0 GCEvent::Impl::Wait(unsigned int, bool) + 296 (events.cpp:157)
3   50iOS                           0x000000010089903c WKS::gc_heap::bgc_thread_function() + 196 (gc.cpp:39189)
4   50iOS                           0x0000000100862620 GCToEEInterface::CreateThread(void (*)(void*), void*, bool, char const*)::$_0::__invoke(void*) + 84 (gcrhenv.cpp:1044)
5   libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
6   libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 13:
0   libsystem_kernel.dylib          0x00000001fb851b1c __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib         0x000000021e07b000 _pthread_cond_wait + 1272 (pthread_cond.c:862)
2   50iOS                           0x00000001008cac68 SystemNative_LowLevelMonitor_TimedWait + 104 (pal_threading.c:201)
3   50iOS                           0x0000000100c7510c fram0_S_P_CoreLib_System_Threading_WaitSubsystem_ThreadWaitInfo__Wait + 524
4   50iOS                           0x0000000100c759e8 fram0_S_P_CoreLib_System_Threading_WaitSubsystem_WaitableObject__Wait + 168
5   50iOS                           0x0000000100bd6810 fram0_S_P_CoreLib_System_Threading_LowLevelLifoSemaphore__WaitForSignal + 144
6   50iOS                           0x0000000100bd675c fram0_S_P_CoreLib_System_Threading_LowLevelLifoSemaphore__Wait + 476
7   50iOS                           0x0000000100c74464 fram0_S_P_CoreLib_System_Threading_PortableThreadPool_WorkerThread__WorkerThreadStart + 548
8   50iOS                           0x0000000100bd5a70 fram0_S_P_CoreLib_System_Threading_Thread__StartThread + 400
9   50iOS                           0x0000000100bd5fe0 fram0_S_P_CoreLib_System_Threading_Thread__ThreadEntryPoint + 32
10  libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
11  libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000103   x1: 0x0000000000000006   x2: 0x000000016f5b9340   x3: 0x000000016f5b933c
    x4: 0x00000d4a00000000   x5: 0x00009c1700000000   x6: 0x0000000000000040   x7: 0x0000000000000000
    x8: 0x0000000100000000   x9: 0xe4a3d25b6bea00f6  x10: 0x0000000000110200  x11: 0x0000000000000001
   x12: 0x0000000000000000  x13: 0x0000040000000400  x14: 0x0000010000000102  x15: 0x000000010a6cdcf0
   x16: 0x00000001fb8654e4  x17: 0x0000000000000238  x18: 0x0000000000000000  x19: 0x000000016f5b933c
   x20: 0x000000016f5b9340  x21: 0x000000016f5b94a0  x22: 0x0000000000000103  x23: 0x000000016f5b9340
   x24: 0x0000000104c11fac  x25: 0x0000000104c126a8  x26: 0x000000000000a58a  x27: 0x0000000104c10b18
   x28: 0x0000000104c0e000   fp: 0x000000016f5b9320   lr: 0x0971a381fb865568
    sp: 0x000000016f5b7e80   pc: 0x00000001fb856398 cpsr: 0x60000000
   esr: 0x92000047 (Data Abort) byte write Translation fault


Binary Images:
        0x10074c000 -         0x1045abfff 50iOS arm64  <6dfc84c792853e619216c450bf44fd90> /private/var/containers/Bundle/Application/056E6B9D-D530-472A-B492-22AC465667AD/50iOS.app/50iOS
        0x105f98000 -         0x1060cbfff libHarfBuzzSharp arm64  <9963a21c847c33409c756a1056a8a6b3> /private/var/containers/Bundle/Application/056E6B9D-D530-472A-B492-22AC465667AD/50iOS.app/Frameworks/libHarfBuzzSharp.framework/libHarfBuzzSharp
        0x1060e8000 -         0x1060f3fff libobjc-trampolines.dylib arm64e  <26d68e81199a300dbc1530ba4630a611> /private/preboot/Cryptexes/OS/usr/lib/libobjc-trampolines.dylib
        0x106ccc000 -         0x10714ffff realm-wrappers arm64  <8941ce42ef16390780d0d6bc842d1c04> /private/var/containers/Bundle/Application/056E6B9D-D530-472A-B492-22AC465667AD/50iOS.app/Frameworks/realm-wrappers.framework/realm-wrappers
        0x10737c000 -         0x10790bfff libSkiaSharp arm64  <a3389983874b3be0b7deeeb8a1de8bcb> /private/var/containers/Bundle/Application/056E6B9D-D530-472A-B492-22AC465667AD/50iOS.app/Frameworks/libSkiaSharp.framework/libSkiaSharp
        0x1b311c000 -         0x1b3c7bfff Foundation arm64e  <c52a963060f13d48a6c350a20de78c6a> /System/Library/Frameworks/Foundation.framework/Foundation
        0x1b4182000 -         0x1b46aefff CoreFoundation arm64e  <be405d8a546437a3a17e1068db404b23> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
        0x1b5259000 -         0x1b5634fff CFNetwork arm64e  <707e82b749fc31aaa493f47aac5c7c41> /System/Library/Frameworks/CFNetwork.framework/CFNetwork
        0x1b63ad000 -         0x1b7e82fff UIKitCore arm64e  <99ad2a319360369f9c0ba7a0af33e2e7> /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
        0x1bc1b8000 -         0x1bc235ff3 libsystem_c.dylib arm64e  <6e5a7692c1e935adb20bc307991df11c> /usr/lib/system/libsystem_c.dylib
        0x1fb850000 -         0x1fb888fef libsystem_kernel.dylib arm64e  <55f2cc41248837bdbb95ea2ffd7611ae> /usr/lib/system/libsystem_kernel.dylib
        0x21e07a000 -         0x21e085ff3 libsystem_pthread.dylib arm64e  <e9ae8dcfc2b635d7af24e008b8034e31> /usr/lib/system/libsystem_pthread.dylib

EOF

Example Project (If Possible)

Our project could be shared privately on request.

Copied from original issue xamarin/xamarin-macios#19950

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Jan 29, 2024
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jan 29, 2024
@ghost
Copy link

ghost commented Jan 29, 2024

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Issue Details

From @charlesroddie on Mon, 29 Jan 2024 17:25:32 GMT

Our NativeAOT-compiled ios app crashes after a certain period of time from one of the pages, with a crash report indicating GC issues. We would like help on how to diagnose this. We understand very little of it beyond the fact that System.Linq is involved (we use almost no System.Linq but we use realm which uses it) and GC. Is there any other info we should be getting?

Steps to Reproduce

Get the Summatic IOS app from testflight or the Store. Navigate to a question. Wait 20-30mins.

Expected Behavior

Nothing happens

Actual Behavior

The app crashes. This crash is not registered on AppCenter and does not trigger Runtime.MarshalManagedException or Runtime.MarshalObjectiveCException or AppDomain.CurrentDomain.UnhandledException or TaskScheduler.UnobservedTaskException. There is a crash report on Testflight, attached below.

Environment

Version information
Azure pipelines macos-13 image version 
Xcode_15.2.app
dotnet 8.0.100

Build Logs

Available if useful

Symbolicated crash report

Incident Identifier: 63B21B2A-747E-4906-AFA3-F29386F3B088
Hardware Model:      iPad12,1
Process:             50iOS [7014]
Path:                /private/var/containers/Bundle/Application/056E6B9D-D530-472A-B492-22AC465667AD/50iOS.app/50iOS
Identifier:          com.summatic.ios
Version:             2.16.11 (1706536244)
AppStoreTools:       15C5500a
AppVariant:          1:iPad12,1:17
Beta:                YES
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           com.summatic.ios [567]

Date/Time:           2024-01-29 14:23:03.9926 +0000
Launch Time:         2024-01-29 14:12:57.1397 +0000
OS Version:          iPhone OS 17.2 (21C62)
Release Type:        User
Report Version:      104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_PROTECTION_FAILURE at 0x000000016f5b7e98
Exception Codes: 0x0000000000000002, 0x000000016f5b7e98
VM Region Info: 0x16f5b7e98 is in 0x16f5b4000-0x16f5b8000;  bytes after start: 16024  bytes before end: 359
      REGION TYPE                 START - END      [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      MALLOC_TINY              13b600000-13b700000 [ 1024K] rw-/rwx SM=PRV  
      GAP OF 0x33eb4000 BYTES
--->  STACK GUARD              16f5b4000-16f5b8000 [   16K] ---/rwx SM=NUL  ... for thread 0
      Stack                    16f5b8000-16f6b4000 [ 1008K] rw-/rwx SM=SHM  thread 0
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [7014]

Triggered by Thread:  0




Thread 0 Crashed:
0   libsystem_kernel.dylib          0x00000001fb856398 thread_get_state + 52 (thread_actUser.c:727)
1   libsystem_kernel.dylib          0x00000001fb865568 thread_get_register_pointer_values + 132 (thread_register_state.c:63)
2   50iOS                           0x00000001008b355c GCToOSInterface::FlushProcessWriteBuffers() + 140 (gcenv.unix.cpp:456)
3   50iOS                           0x00000001008688fc ThreadStore::SuspendAllThreads(bool) + 128 (threadstore.cpp:264)
4   50iOS                           0x0000000100861cac GCToEEInterface::SuspendEE(SUSPEND_REASON) + 128 (gcrhenv.cpp:591)
5   50iOS                           0x000000010087c1f4 WKS::GCHeap::GarbageCollectGeneration(unsigned int, gc_reason) + 696 (gc.cpp:50492)
6   50iOS                           0x000000010087e4e4 WKS::gc_heap::try_allocate_more_space(alloc_context*, unsigned long, unsigned int, int) + 964 (gc.cpp:19049)
7   50iOS                           0x00000001008a28e0 WKS::GCHeap::Alloc(gc_alloc_context*, unsigned long, unsigned int) + 256 (gc.cpp:49460)
8   50iOS                           0x00000001008617f8 RhpGcAlloc + 256 (gcrhenv.cpp:251)
9   50iOS                           0x00000001008bfe90 RhpNewObject + 60
10  50iOS                           0x000000010213ee08 fram0_System_Linq_System_Linq_Enumerable_Concat2Iterator_1<System___Canon>__Clone + 40
11  50iOS                           0x000000010213f5f8 fram0_System_Linq_System_Linq_Enumerable_Iterator_1<System___Canon>__GetEnumerator + 56
12  50iOS                           0x000000010213f22c fram0_System_Linq_System_Linq_Enumerable_ConcatIterator_1<System___Canon>__MoveNext + 76
13  50iOS                           0x000000010213f264 fram0_System_Linq_System_Linq_Enumerable_ConcatIterator_1<System___Canon>__MoveNext + 132

Thread 1:
0   libsystem_kernel.dylib          0x00000001fb851b1c __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib         0x000000021e07afd4 _pthread_cond_wait + 1228 (pthread_cond.c:862)
2   50iOS                           0x00000001008b2fe8 UnixEvent::Wait(unsigned int) + 232 (PalRedhawkUnix.cpp:272)
3   50iOS                           0x000000010085fbf8 RhpWaitForFinalizerRequest + 52 (FinalizerHelpers.cpp:148)
4   50iOS                           0x0000000100c1f3d0 S_P_CoreLib_System_Runtime___Finalizer__ProcessFinalizers + 48
5   50iOS                           0x000000010085fac4 FinalizerStart(void*) + 88 (FinalizerHelpers.cpp:67)
6   libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
7   libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 2:
0   libsystem_kernel.dylib          0x00000001fb851178 mach_msg2_trap + 8 (:-1)
1   libsystem_kernel.dylib          0x00000001fb850f10 mach_msg2_internal + 80 (mach_msg.c:201)
2   libsystem_kernel.dylib          0x00000001fb850e28 mach_msg_overwrite + 436 (mach_msg.c:0)
3   libsystem_kernel.dylib          0x00000001fb850c68 mach_msg + 24 (mach_msg.c:323)
4   CoreFoundation                  0x00000001b41b7b1c __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2624)
5   CoreFoundation                  0x00000001b41b5a14 __CFRunLoopRun + 1208 (CFRunLoop.c:3007)
6   CoreFoundation                  0x00000001b41b5478 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)
7   Foundation                      0x00000001b314848c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 (NSRunLoop.m:373)
8   Foundation                      0x00000001b317574c -[NSRunLoop(NSRunLoop) runUntilDate:] + 64 (NSRunLoop.m:420)
9   UIKitCore                       0x00000001b653b4a8 -[UIEventFetcher threadMain] + 420 (UIEventFetcher.m:1208)
10  Foundation                      0x00000001b31cbde0 __NSThread__start__ + 732 (NSThread.m:991)
11  libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
12  libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 3:
0   libsystem_kernel.dylib          0x00000001fb851b1c __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib         0x000000021e07b000 _pthread_cond_wait + 1272 (pthread_cond.c:862)
2   50iOS                           0x00000001008cac68 SystemNative_LowLevelMonitor_TimedWait + 104 (pal_threading.c:201)
3   50iOS                           0x0000000100c7510c fram0_S_P_CoreLib_System_Threading_WaitSubsystem_ThreadWaitInfo__Wait + 524
4   50iOS                           0x0000000100c759e8 fram0_S_P_CoreLib_System_Threading_WaitSubsystem_WaitableObject__Wait + 168
5   50iOS                           0x0000000100be1734 fram0_S_P_CoreLib_System_Threading_WaitHandle__WaitOneNoCheck + 228
6   50iOS                           0x0000000100be1628 fram0_S_P_CoreLib_System_Threading_WaitHandle__WaitOne + 24
7   50iOS                           0x0000000100c72768 fram0_S_P_CoreLib_System_Threading_PortableThreadPool_GateThread__GateThreadStart + 360
8   50iOS                           0x0000000100bd5a70 fram0_S_P_CoreLib_System_Threading_Thread__StartThread + 400
9   50iOS                           0x0000000100bd5fe0 fram0_S_P_CoreLib_System_Threading_Thread__ThreadEntryPoint + 32
10  libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
11  libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 4:
0   libsystem_kernel.dylib          0x00000001fb851b1c __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib         0x000000021e07b000 _pthread_cond_wait + 1272 (pthread_cond.c:862)
2   50iOS                           0x00000001008cac68 SystemNative_LowLevelMonitor_TimedWait + 104 (pal_threading.c:201)
3   50iOS                           0x0000000100c7510c fram0_S_P_CoreLib_System_Threading_WaitSubsystem_ThreadWaitInfo__Wait + 524
4   50iOS                           0x0000000100c759e8 fram0_S_P_CoreLib_System_Threading_WaitSubsystem_WaitableObject__Wait + 168
5   50iOS                           0x0000000100bd6810 fram0_S_P_CoreLib_System_Threading_LowLevelLifoSemaphore__WaitForSignal + 144
6   50iOS                           0x0000000100bd675c fram0_S_P_CoreLib_System_Threading_LowLevelLifoSemaphore__Wait + 476
7   50iOS                           0x0000000100c74464 fram0_S_P_CoreLib_System_Threading_PortableThreadPool_WorkerThread__WorkerThreadStart + 548
8   50iOS                           0x0000000100bd5a70 fram0_S_P_CoreLib_System_Threading_Thread__StartThread + 400
9   50iOS                           0x0000000100bd5fe0 fram0_S_P_CoreLib_System_Threading_Thread__ThreadEntryPoint + 32
10  libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
11  libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 5:
0   libsystem_kernel.dylib          0x00000001fb851b1c __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib         0x000000021e07b000 _pthread_cond_wait + 1272 (pthread_cond.c:862)
2   50iOS                           0x00000001008cac68 SystemNative_LowLevelMonitor_TimedWait + 104 (pal_threading.c:201)
3   50iOS                           0x0000000100c7510c fram0_S_P_CoreLib_System_Threading_WaitSubsystem_ThreadWaitInfo__Wait + 524
4   50iOS                           0x0000000100c759e8 fram0_S_P_CoreLib_System_Threading_WaitSubsystem_WaitableObject__Wait + 168
5   50iOS                           0x0000000100be1734 fram0_S_P_CoreLib_System_Threading_WaitHandle__WaitOneNoCheck + 228
6   50iOS                           0x0000000100be1628 fram0_S_P_CoreLib_System_Threading_WaitHandle__WaitOne + 24
7   50iOS                           0x0000000100be0444 fram0_S_P_CoreLib_System_Threading_TimerQueue__TimerThread + 132
8   50iOS                           0x0000000100bd5a70 fram0_S_P_CoreLib_System_Threading_Thread__StartThread + 400
9   50iOS                           0x0000000100bd5fe0 fram0_S_P_CoreLib_System_Threading_Thread__ThreadEntryPoint + 32
10  libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
11  libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 6:
0   libsystem_kernel.dylib          0x00000001fb851178 mach_msg2_trap + 8 (:-1)
1   libsystem_kernel.dylib          0x00000001fb850f10 mach_msg2_internal + 80 (mach_msg.c:201)
2   libsystem_kernel.dylib          0x00000001fb850e28 mach_msg_overwrite + 436 (mach_msg.c:0)
3   libsystem_kernel.dylib          0x00000001fb850c68 mach_msg + 24 (mach_msg.c:323)
4   CoreFoundation                  0x00000001b41b7b1c __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2624)
5   CoreFoundation                  0x00000001b41b5a14 __CFRunLoopRun + 1208 (CFRunLoop.c:3007)
6   CoreFoundation                  0x00000001b41b5478 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)
7   CFNetwork                       0x00000001b54b3060 +[__CFN_CoreSchedulingSetRunnable _run:] + 384 (CoreSchedulingSet.mm:1479)
8   Foundation                      0x00000001b31cbde0 __NSThread__start__ + 732 (NSThread.m:991)
9   libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
10  libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 7:
0   libsystem_pthread.dylib         0x000000021e07b9fc start_wqthread + 0 (:-1)

Thread 8:
0   libsystem_pthread.dylib         0x000000021e07b9fc start_wqthread + 0 (:-1)

Thread 9:
0   libsystem_pthread.dylib         0x000000021e07b9fc start_wqthread + 0 (:-1)

Thread 10:
0   libsystem_pthread.dylib         0x000000021e07b9fc start_wqthread + 0 (:-1)

Thread 11:
0   libsystem_kernel.dylib          0x00000001fb851b1c __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib         0x000000021e07b000 _pthread_cond_wait + 1272 (pthread_cond.c:862)
2   50iOS                           0x00000001008cac68 SystemNative_LowLevelMonitor_TimedWait + 104 (pal_threading.c:201)
3   50iOS                           0x0000000100c7510c fram0_S_P_CoreLib_System_Threading_WaitSubsystem_ThreadWaitInfo__Wait + 524
4   50iOS                           0x0000000100c759e8 fram0_S_P_CoreLib_System_Threading_WaitSubsystem_WaitableObject__Wait + 168
5   50iOS                           0x0000000100bd6810 fram0_S_P_CoreLib_System_Threading_LowLevelLifoSemaphore__WaitForSignal + 144
6   50iOS                           0x0000000100bd675c fram0_S_P_CoreLib_System_Threading_LowLevelLifoSemaphore__Wait + 476
7   50iOS                           0x0000000100c74464 fram0_S_P_CoreLib_System_Threading_PortableThreadPool_WorkerThread__WorkerThreadStart + 548
8   50iOS                           0x0000000100bd5a70 fram0_S_P_CoreLib_System_Threading_Thread__StartThread + 400
9   50iOS                           0x0000000100bd5fe0 fram0_S_P_CoreLib_System_Threading_Thread__ThreadEntryPoint + 32
10  libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
11  libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 12:
0   libsystem_kernel.dylib          0x00000001fb851b1c __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib         0x000000021e07b000 _pthread_cond_wait + 1272 (pthread_cond.c:862)
2   50iOS                           0x00000001008b43d0 GCEvent::Impl::Wait(unsigned int, bool) + 296 (events.cpp:157)
3   50iOS                           0x000000010089903c WKS::gc_heap::bgc_thread_function() + 196 (gc.cpp:39189)
4   50iOS                           0x0000000100862620 GCToEEInterface::CreateThread(void (*)(void*), void*, bool, char const*)::$_0::__invoke(void*) + 84 (gcrhenv.cpp:1044)
5   libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
6   libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 13:
0   libsystem_kernel.dylib          0x00000001fb851b1c __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib         0x000000021e07b000 _pthread_cond_wait + 1272 (pthread_cond.c:862)
2   50iOS                           0x00000001008cac68 SystemNative_LowLevelMonitor_TimedWait + 104 (pal_threading.c:201)
3   50iOS                           0x0000000100c7510c fram0_S_P_CoreLib_System_Threading_WaitSubsystem_ThreadWaitInfo__Wait + 524
4   50iOS                           0x0000000100c759e8 fram0_S_P_CoreLib_System_Threading_WaitSubsystem_WaitableObject__Wait + 168
5   50iOS                           0x0000000100bd6810 fram0_S_P_CoreLib_System_Threading_LowLevelLifoSemaphore__WaitForSignal + 144
6   50iOS                           0x0000000100bd675c fram0_S_P_CoreLib_System_Threading_LowLevelLifoSemaphore__Wait + 476
7   50iOS                           0x0000000100c74464 fram0_S_P_CoreLib_System_Threading_PortableThreadPool_WorkerThread__WorkerThreadStart + 548
8   50iOS                           0x0000000100bd5a70 fram0_S_P_CoreLib_System_Threading_Thread__StartThread + 400
9   50iOS                           0x0000000100bd5fe0 fram0_S_P_CoreLib_System_Threading_Thread__ThreadEntryPoint + 32
10  libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
11  libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000103   x1: 0x0000000000000006   x2: 0x000000016f5b9340   x3: 0x000000016f5b933c
    x4: 0x00000d4a00000000   x5: 0x00009c1700000000   x6: 0x0000000000000040   x7: 0x0000000000000000
    x8: 0x0000000100000000   x9: 0xe4a3d25b6bea00f6  x10: 0x0000000000110200  x11: 0x0000000000000001
   x12: 0x0000000000000000  x13: 0x0000040000000400  x14: 0x0000010000000102  x15: 0x000000010a6cdcf0
   x16: 0x00000001fb8654e4  x17: 0x0000000000000238  x18: 0x0000000000000000  x19: 0x000000016f5b933c
   x20: 0x000000016f5b9340  x21: 0x000000016f5b94a0  x22: 0x0000000000000103  x23: 0x000000016f5b9340
   x24: 0x0000000104c11fac  x25: 0x0000000104c126a8  x26: 0x000000000000a58a  x27: 0x0000000104c10b18
   x28: 0x0000000104c0e000   fp: 0x000000016f5b9320   lr: 0x0971a381fb865568
    sp: 0x000000016f5b7e80   pc: 0x00000001fb856398 cpsr: 0x60000000
   esr: 0x92000047 (Data Abort) byte write Translation fault


Binary Images:
        0x10074c000 -         0x1045abfff 50iOS arm64  <6dfc84c792853e619216c450bf44fd90> /private/var/containers/Bundle/Application/056E6B9D-D530-472A-B492-22AC465667AD/50iOS.app/50iOS
        0x105f98000 -         0x1060cbfff libHarfBuzzSharp arm64  <9963a21c847c33409c756a1056a8a6b3> /private/var/containers/Bundle/Application/056E6B9D-D530-472A-B492-22AC465667AD/50iOS.app/Frameworks/libHarfBuzzSharp.framework/libHarfBuzzSharp
        0x1060e8000 -         0x1060f3fff libobjc-trampolines.dylib arm64e  <26d68e81199a300dbc1530ba4630a611> /private/preboot/Cryptexes/OS/usr/lib/libobjc-trampolines.dylib
        0x106ccc000 -         0x10714ffff realm-wrappers arm64  <8941ce42ef16390780d0d6bc842d1c04> /private/var/containers/Bundle/Application/056E6B9D-D530-472A-B492-22AC465667AD/50iOS.app/Frameworks/realm-wrappers.framework/realm-wrappers
        0x10737c000 -         0x10790bfff libSkiaSharp arm64  <a3389983874b3be0b7deeeb8a1de8bcb> /private/var/containers/Bundle/Application/056E6B9D-D530-472A-B492-22AC465667AD/50iOS.app/Frameworks/libSkiaSharp.framework/libSkiaSharp
        0x1b311c000 -         0x1b3c7bfff Foundation arm64e  <c52a963060f13d48a6c350a20de78c6a> /System/Library/Frameworks/Foundation.framework/Foundation
        0x1b4182000 -         0x1b46aefff CoreFoundation arm64e  <be405d8a546437a3a17e1068db404b23> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
        0x1b5259000 -         0x1b5634fff CFNetwork arm64e  <707e82b749fc31aaa493f47aac5c7c41> /System/Library/Frameworks/CFNetwork.framework/CFNetwork
        0x1b63ad000 -         0x1b7e82fff UIKitCore arm64e  <99ad2a319360369f9c0ba7a0af33e2e7> /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
        0x1bc1b8000 -         0x1bc235ff3 libsystem_c.dylib arm64e  <6e5a7692c1e935adb20bc307991df11c> /usr/lib/system/libsystem_c.dylib
        0x1fb850000 -         0x1fb888fef libsystem_kernel.dylib arm64e  <55f2cc41248837bdbb95ea2ffd7611ae> /usr/lib/system/libsystem_kernel.dylib
        0x21e07a000 -         0x21e085ff3 libsystem_pthread.dylib arm64e  <e9ae8dcfc2b635d7af24e008b8034e31> /usr/lib/system/libsystem_pthread.dylib

EOF

Example Project (If Possible)

Our project could be shared privately on request.

Copied from original issue xamarin/xamarin-macios#19950

Author: rolfbjarne
Assignees: -
Labels:

untriaged, area-NativeAOT-coreclr, needs-area-label

Milestone: -

@jkotas jkotas added os-ios Apple iOS and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Jan 29, 2024
@ghost
Copy link

ghost commented Jan 29, 2024

Tagging subscribers to 'os-ios': @steveisok, @akoeplinger, @kotlarmilos
See info in area-owners.md if you want to be subscribed.

Issue Details

From @charlesroddie on Mon, 29 Jan 2024 17:25:32 GMT

Our NativeAOT-compiled ios app crashes after a certain period of time from one of the pages, with a crash report indicating GC issues. We would like help on how to diagnose this. We understand very little of it beyond the fact that System.Linq is involved (we use almost no System.Linq but we use realm which uses it) and GC. Is there any other info we should be getting?

Steps to Reproduce

Get the Summatic IOS app from testflight or the Store. Navigate to a question. Wait 20-30mins.

Expected Behavior

Nothing happens

Actual Behavior

The app crashes. This crash is not registered on AppCenter and does not trigger Runtime.MarshalManagedException or Runtime.MarshalObjectiveCException or AppDomain.CurrentDomain.UnhandledException or TaskScheduler.UnobservedTaskException. There is a crash report on Testflight, attached below.

Environment

Version information
Azure pipelines macos-13 image version 
Xcode_15.2.app
dotnet 8.0.100

Build Logs

Available if useful

Symbolicated crash report

Incident Identifier: 63B21B2A-747E-4906-AFA3-F29386F3B088
Hardware Model:      iPad12,1
Process:             50iOS [7014]
Path:                /private/var/containers/Bundle/Application/056E6B9D-D530-472A-B492-22AC465667AD/50iOS.app/50iOS
Identifier:          com.summatic.ios
Version:             2.16.11 (1706536244)
AppStoreTools:       15C5500a
AppVariant:          1:iPad12,1:17
Beta:                YES
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           com.summatic.ios [567]

Date/Time:           2024-01-29 14:23:03.9926 +0000
Launch Time:         2024-01-29 14:12:57.1397 +0000
OS Version:          iPhone OS 17.2 (21C62)
Release Type:        User
Report Version:      104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_PROTECTION_FAILURE at 0x000000016f5b7e98
Exception Codes: 0x0000000000000002, 0x000000016f5b7e98
VM Region Info: 0x16f5b7e98 is in 0x16f5b4000-0x16f5b8000;  bytes after start: 16024  bytes before end: 359
      REGION TYPE                 START - END      [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      MALLOC_TINY              13b600000-13b700000 [ 1024K] rw-/rwx SM=PRV  
      GAP OF 0x33eb4000 BYTES
--->  STACK GUARD              16f5b4000-16f5b8000 [   16K] ---/rwx SM=NUL  ... for thread 0
      Stack                    16f5b8000-16f6b4000 [ 1008K] rw-/rwx SM=SHM  thread 0
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [7014]

Triggered by Thread:  0




Thread 0 Crashed:
0   libsystem_kernel.dylib          0x00000001fb856398 thread_get_state + 52 (thread_actUser.c:727)
1   libsystem_kernel.dylib          0x00000001fb865568 thread_get_register_pointer_values + 132 (thread_register_state.c:63)
2   50iOS                           0x00000001008b355c GCToOSInterface::FlushProcessWriteBuffers() + 140 (gcenv.unix.cpp:456)
3   50iOS                           0x00000001008688fc ThreadStore::SuspendAllThreads(bool) + 128 (threadstore.cpp:264)
4   50iOS                           0x0000000100861cac GCToEEInterface::SuspendEE(SUSPEND_REASON) + 128 (gcrhenv.cpp:591)
5   50iOS                           0x000000010087c1f4 WKS::GCHeap::GarbageCollectGeneration(unsigned int, gc_reason) + 696 (gc.cpp:50492)
6   50iOS                           0x000000010087e4e4 WKS::gc_heap::try_allocate_more_space(alloc_context*, unsigned long, unsigned int, int) + 964 (gc.cpp:19049)
7   50iOS                           0x00000001008a28e0 WKS::GCHeap::Alloc(gc_alloc_context*, unsigned long, unsigned int) + 256 (gc.cpp:49460)
8   50iOS                           0x00000001008617f8 RhpGcAlloc + 256 (gcrhenv.cpp:251)
9   50iOS                           0x00000001008bfe90 RhpNewObject + 60
10  50iOS                           0x000000010213ee08 fram0_System_Linq_System_Linq_Enumerable_Concat2Iterator_1<System___Canon>__Clone + 40
11  50iOS                           0x000000010213f5f8 fram0_System_Linq_System_Linq_Enumerable_Iterator_1<System___Canon>__GetEnumerator + 56
12  50iOS                           0x000000010213f22c fram0_System_Linq_System_Linq_Enumerable_ConcatIterator_1<System___Canon>__MoveNext + 76
13  50iOS                           0x000000010213f264 fram0_System_Linq_System_Linq_Enumerable_ConcatIterator_1<System___Canon>__MoveNext + 132

Thread 1:
0   libsystem_kernel.dylib          0x00000001fb851b1c __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib         0x000000021e07afd4 _pthread_cond_wait + 1228 (pthread_cond.c:862)
2   50iOS                           0x00000001008b2fe8 UnixEvent::Wait(unsigned int) + 232 (PalRedhawkUnix.cpp:272)
3   50iOS                           0x000000010085fbf8 RhpWaitForFinalizerRequest + 52 (FinalizerHelpers.cpp:148)
4   50iOS                           0x0000000100c1f3d0 S_P_CoreLib_System_Runtime___Finalizer__ProcessFinalizers + 48
5   50iOS                           0x000000010085fac4 FinalizerStart(void*) + 88 (FinalizerHelpers.cpp:67)
6   libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
7   libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 2:
0   libsystem_kernel.dylib          0x00000001fb851178 mach_msg2_trap + 8 (:-1)
1   libsystem_kernel.dylib          0x00000001fb850f10 mach_msg2_internal + 80 (mach_msg.c:201)
2   libsystem_kernel.dylib          0x00000001fb850e28 mach_msg_overwrite + 436 (mach_msg.c:0)
3   libsystem_kernel.dylib          0x00000001fb850c68 mach_msg + 24 (mach_msg.c:323)
4   CoreFoundation                  0x00000001b41b7b1c __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2624)
5   CoreFoundation                  0x00000001b41b5a14 __CFRunLoopRun + 1208 (CFRunLoop.c:3007)
6   CoreFoundation                  0x00000001b41b5478 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)
7   Foundation                      0x00000001b314848c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 (NSRunLoop.m:373)
8   Foundation                      0x00000001b317574c -[NSRunLoop(NSRunLoop) runUntilDate:] + 64 (NSRunLoop.m:420)
9   UIKitCore                       0x00000001b653b4a8 -[UIEventFetcher threadMain] + 420 (UIEventFetcher.m:1208)
10  Foundation                      0x00000001b31cbde0 __NSThread__start__ + 732 (NSThread.m:991)
11  libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
12  libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 3:
0   libsystem_kernel.dylib          0x00000001fb851b1c __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib         0x000000021e07b000 _pthread_cond_wait + 1272 (pthread_cond.c:862)
2   50iOS                           0x00000001008cac68 SystemNative_LowLevelMonitor_TimedWait + 104 (pal_threading.c:201)
3   50iOS                           0x0000000100c7510c fram0_S_P_CoreLib_System_Threading_WaitSubsystem_ThreadWaitInfo__Wait + 524
4   50iOS                           0x0000000100c759e8 fram0_S_P_CoreLib_System_Threading_WaitSubsystem_WaitableObject__Wait + 168
5   50iOS                           0x0000000100be1734 fram0_S_P_CoreLib_System_Threading_WaitHandle__WaitOneNoCheck + 228
6   50iOS                           0x0000000100be1628 fram0_S_P_CoreLib_System_Threading_WaitHandle__WaitOne + 24
7   50iOS                           0x0000000100c72768 fram0_S_P_CoreLib_System_Threading_PortableThreadPool_GateThread__GateThreadStart + 360
8   50iOS                           0x0000000100bd5a70 fram0_S_P_CoreLib_System_Threading_Thread__StartThread + 400
9   50iOS                           0x0000000100bd5fe0 fram0_S_P_CoreLib_System_Threading_Thread__ThreadEntryPoint + 32
10  libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
11  libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 4:
0   libsystem_kernel.dylib          0x00000001fb851b1c __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib         0x000000021e07b000 _pthread_cond_wait + 1272 (pthread_cond.c:862)
2   50iOS                           0x00000001008cac68 SystemNative_LowLevelMonitor_TimedWait + 104 (pal_threading.c:201)
3   50iOS                           0x0000000100c7510c fram0_S_P_CoreLib_System_Threading_WaitSubsystem_ThreadWaitInfo__Wait + 524
4   50iOS                           0x0000000100c759e8 fram0_S_P_CoreLib_System_Threading_WaitSubsystem_WaitableObject__Wait + 168
5   50iOS                           0x0000000100bd6810 fram0_S_P_CoreLib_System_Threading_LowLevelLifoSemaphore__WaitForSignal + 144
6   50iOS                           0x0000000100bd675c fram0_S_P_CoreLib_System_Threading_LowLevelLifoSemaphore__Wait + 476
7   50iOS                           0x0000000100c74464 fram0_S_P_CoreLib_System_Threading_PortableThreadPool_WorkerThread__WorkerThreadStart + 548
8   50iOS                           0x0000000100bd5a70 fram0_S_P_CoreLib_System_Threading_Thread__StartThread + 400
9   50iOS                           0x0000000100bd5fe0 fram0_S_P_CoreLib_System_Threading_Thread__ThreadEntryPoint + 32
10  libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
11  libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 5:
0   libsystem_kernel.dylib          0x00000001fb851b1c __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib         0x000000021e07b000 _pthread_cond_wait + 1272 (pthread_cond.c:862)
2   50iOS                           0x00000001008cac68 SystemNative_LowLevelMonitor_TimedWait + 104 (pal_threading.c:201)
3   50iOS                           0x0000000100c7510c fram0_S_P_CoreLib_System_Threading_WaitSubsystem_ThreadWaitInfo__Wait + 524
4   50iOS                           0x0000000100c759e8 fram0_S_P_CoreLib_System_Threading_WaitSubsystem_WaitableObject__Wait + 168
5   50iOS                           0x0000000100be1734 fram0_S_P_CoreLib_System_Threading_WaitHandle__WaitOneNoCheck + 228
6   50iOS                           0x0000000100be1628 fram0_S_P_CoreLib_System_Threading_WaitHandle__WaitOne + 24
7   50iOS                           0x0000000100be0444 fram0_S_P_CoreLib_System_Threading_TimerQueue__TimerThread + 132
8   50iOS                           0x0000000100bd5a70 fram0_S_P_CoreLib_System_Threading_Thread__StartThread + 400
9   50iOS                           0x0000000100bd5fe0 fram0_S_P_CoreLib_System_Threading_Thread__ThreadEntryPoint + 32
10  libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
11  libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 6:
0   libsystem_kernel.dylib          0x00000001fb851178 mach_msg2_trap + 8 (:-1)
1   libsystem_kernel.dylib          0x00000001fb850f10 mach_msg2_internal + 80 (mach_msg.c:201)
2   libsystem_kernel.dylib          0x00000001fb850e28 mach_msg_overwrite + 436 (mach_msg.c:0)
3   libsystem_kernel.dylib          0x00000001fb850c68 mach_msg + 24 (mach_msg.c:323)
4   CoreFoundation                  0x00000001b41b7b1c __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2624)
5   CoreFoundation                  0x00000001b41b5a14 __CFRunLoopRun + 1208 (CFRunLoop.c:3007)
6   CoreFoundation                  0x00000001b41b5478 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)
7   CFNetwork                       0x00000001b54b3060 +[__CFN_CoreSchedulingSetRunnable _run:] + 384 (CoreSchedulingSet.mm:1479)
8   Foundation                      0x00000001b31cbde0 __NSThread__start__ + 732 (NSThread.m:991)
9   libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
10  libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 7:
0   libsystem_pthread.dylib         0x000000021e07b9fc start_wqthread + 0 (:-1)

Thread 8:
0   libsystem_pthread.dylib         0x000000021e07b9fc start_wqthread + 0 (:-1)

Thread 9:
0   libsystem_pthread.dylib         0x000000021e07b9fc start_wqthread + 0 (:-1)

Thread 10:
0   libsystem_pthread.dylib         0x000000021e07b9fc start_wqthread + 0 (:-1)

Thread 11:
0   libsystem_kernel.dylib          0x00000001fb851b1c __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib         0x000000021e07b000 _pthread_cond_wait + 1272 (pthread_cond.c:862)
2   50iOS                           0x00000001008cac68 SystemNative_LowLevelMonitor_TimedWait + 104 (pal_threading.c:201)
3   50iOS                           0x0000000100c7510c fram0_S_P_CoreLib_System_Threading_WaitSubsystem_ThreadWaitInfo__Wait + 524
4   50iOS                           0x0000000100c759e8 fram0_S_P_CoreLib_System_Threading_WaitSubsystem_WaitableObject__Wait + 168
5   50iOS                           0x0000000100bd6810 fram0_S_P_CoreLib_System_Threading_LowLevelLifoSemaphore__WaitForSignal + 144
6   50iOS                           0x0000000100bd675c fram0_S_P_CoreLib_System_Threading_LowLevelLifoSemaphore__Wait + 476
7   50iOS                           0x0000000100c74464 fram0_S_P_CoreLib_System_Threading_PortableThreadPool_WorkerThread__WorkerThreadStart + 548
8   50iOS                           0x0000000100bd5a70 fram0_S_P_CoreLib_System_Threading_Thread__StartThread + 400
9   50iOS                           0x0000000100bd5fe0 fram0_S_P_CoreLib_System_Threading_Thread__ThreadEntryPoint + 32
10  libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
11  libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 12:
0   libsystem_kernel.dylib          0x00000001fb851b1c __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib         0x000000021e07b000 _pthread_cond_wait + 1272 (pthread_cond.c:862)
2   50iOS                           0x00000001008b43d0 GCEvent::Impl::Wait(unsigned int, bool) + 296 (events.cpp:157)
3   50iOS                           0x000000010089903c WKS::gc_heap::bgc_thread_function() + 196 (gc.cpp:39189)
4   50iOS                           0x0000000100862620 GCToEEInterface::CreateThread(void (*)(void*), void*, bool, char const*)::$_0::__invoke(void*) + 84 (gcrhenv.cpp:1044)
5   libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
6   libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 13:
0   libsystem_kernel.dylib          0x00000001fb851b1c __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib         0x000000021e07b000 _pthread_cond_wait + 1272 (pthread_cond.c:862)
2   50iOS                           0x00000001008cac68 SystemNative_LowLevelMonitor_TimedWait + 104 (pal_threading.c:201)
3   50iOS                           0x0000000100c7510c fram0_S_P_CoreLib_System_Threading_WaitSubsystem_ThreadWaitInfo__Wait + 524
4   50iOS                           0x0000000100c759e8 fram0_S_P_CoreLib_System_Threading_WaitSubsystem_WaitableObject__Wait + 168
5   50iOS                           0x0000000100bd6810 fram0_S_P_CoreLib_System_Threading_LowLevelLifoSemaphore__WaitForSignal + 144
6   50iOS                           0x0000000100bd675c fram0_S_P_CoreLib_System_Threading_LowLevelLifoSemaphore__Wait + 476
7   50iOS                           0x0000000100c74464 fram0_S_P_CoreLib_System_Threading_PortableThreadPool_WorkerThread__WorkerThreadStart + 548
8   50iOS                           0x0000000100bd5a70 fram0_S_P_CoreLib_System_Threading_Thread__StartThread + 400
9   50iOS                           0x0000000100bd5fe0 fram0_S_P_CoreLib_System_Threading_Thread__ThreadEntryPoint + 32
10  libsystem_pthread.dylib         0x000000021e07c4d4 _pthread_start + 136 (pthread.c:904)
11  libsystem_pthread.dylib         0x000000021e07ba10 thread_start + 8 (:-1)

Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000103   x1: 0x0000000000000006   x2: 0x000000016f5b9340   x3: 0x000000016f5b933c
    x4: 0x00000d4a00000000   x5: 0x00009c1700000000   x6: 0x0000000000000040   x7: 0x0000000000000000
    x8: 0x0000000100000000   x9: 0xe4a3d25b6bea00f6  x10: 0x0000000000110200  x11: 0x0000000000000001
   x12: 0x0000000000000000  x13: 0x0000040000000400  x14: 0x0000010000000102  x15: 0x000000010a6cdcf0
   x16: 0x00000001fb8654e4  x17: 0x0000000000000238  x18: 0x0000000000000000  x19: 0x000000016f5b933c
   x20: 0x000000016f5b9340  x21: 0x000000016f5b94a0  x22: 0x0000000000000103  x23: 0x000000016f5b9340
   x24: 0x0000000104c11fac  x25: 0x0000000104c126a8  x26: 0x000000000000a58a  x27: 0x0000000104c10b18
   x28: 0x0000000104c0e000   fp: 0x000000016f5b9320   lr: 0x0971a381fb865568
    sp: 0x000000016f5b7e80   pc: 0x00000001fb856398 cpsr: 0x60000000
   esr: 0x92000047 (Data Abort) byte write Translation fault


Binary Images:
        0x10074c000 -         0x1045abfff 50iOS arm64  <6dfc84c792853e619216c450bf44fd90> /private/var/containers/Bundle/Application/056E6B9D-D530-472A-B492-22AC465667AD/50iOS.app/50iOS
        0x105f98000 -         0x1060cbfff libHarfBuzzSharp arm64  <9963a21c847c33409c756a1056a8a6b3> /private/var/containers/Bundle/Application/056E6B9D-D530-472A-B492-22AC465667AD/50iOS.app/Frameworks/libHarfBuzzSharp.framework/libHarfBuzzSharp
        0x1060e8000 -         0x1060f3fff libobjc-trampolines.dylib arm64e  <26d68e81199a300dbc1530ba4630a611> /private/preboot/Cryptexes/OS/usr/lib/libobjc-trampolines.dylib
        0x106ccc000 -         0x10714ffff realm-wrappers arm64  <8941ce42ef16390780d0d6bc842d1c04> /private/var/containers/Bundle/Application/056E6B9D-D530-472A-B492-22AC465667AD/50iOS.app/Frameworks/realm-wrappers.framework/realm-wrappers
        0x10737c000 -         0x10790bfff libSkiaSharp arm64  <a3389983874b3be0b7deeeb8a1de8bcb> /private/var/containers/Bundle/Application/056E6B9D-D530-472A-B492-22AC465667AD/50iOS.app/Frameworks/libSkiaSharp.framework/libSkiaSharp
        0x1b311c000 -         0x1b3c7bfff Foundation arm64e  <c52a963060f13d48a6c350a20de78c6a> /System/Library/Frameworks/Foundation.framework/Foundation
        0x1b4182000 -         0x1b46aefff CoreFoundation arm64e  <be405d8a546437a3a17e1068db404b23> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
        0x1b5259000 -         0x1b5634fff CFNetwork arm64e  <707e82b749fc31aaa493f47aac5c7c41> /System/Library/Frameworks/CFNetwork.framework/CFNetwork
        0x1b63ad000 -         0x1b7e82fff UIKitCore arm64e  <99ad2a319360369f9c0ba7a0af33e2e7> /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
        0x1bc1b8000 -         0x1bc235ff3 libsystem_c.dylib arm64e  <6e5a7692c1e935adb20bc307991df11c> /usr/lib/system/libsystem_c.dylib
        0x1fb850000 -         0x1fb888fef libsystem_kernel.dylib arm64e  <55f2cc41248837bdbb95ea2ffd7611ae> /usr/lib/system/libsystem_kernel.dylib
        0x21e07a000 -         0x21e085ff3 libsystem_pthread.dylib arm64e  <e9ae8dcfc2b635d7af24e008b8034e31> /usr/lib/system/libsystem_pthread.dylib

EOF

Example Project (If Possible)

Our project could be shared privately on request.

Copied from original issue xamarin/xamarin-macios#19950

Author: rolfbjarne
Assignees: -
Labels:

untriaged, os-ios, area-NativeAOT-coreclr, needs-area-label

Milestone: -

@jkotas
Copy link
Member

jkotas commented Jan 29, 2024

This is crashing in FlushProcessWriteBuffers introduced in https://github.com/dotnet/runtime/pull/44670/files#diff-236bca3ea8ce55b54c55c47ab9d21a4db9596eb3fbc6052565a81a2ebb3ee73fR3466

This code is iterating over all threads in the process and asking for registers of each thread. The first thing to find out is the thread that it is crashing on.

cc @janvorli

@janvorli
Copy link
Member

Looking at the log above, it seem the problem is a stack overflow. It says:

  • STACK GUARD 16f5b4000-16f5b8000
  • KERN_PROTECTION_FAILURE at 0x000000016f5b7e98

So the access is inside of the stack guard.

@EgorBo
Copy link
Member

EgorBo commented Jan 29, 2024

I presume the default secondary thread stack size on iOS/iPadOS matches macOS and is 512kb as well

@charlesroddie
Copy link

charlesroddie commented Jan 31, 2024

Is this looking like a dotnet/runtime bug? Is there any other info we could find that would help?

It's interesting that are two other reports recently (see linked item immediately above) that also involved ios, gc, release mode, System.Linq, and write barriers of some form, although they were on MonoAOT not NativeAOT. Probably the bug will show if you run System.Linq tests on ios nativeaot (tracked here: #81075)

Since all these reports are very recent, maybe there was a recent update in ios itself that changed something? (I went back to an old testflight from Nov 17th and the bug was there on that version which supports this theory.)

We got this exception previously via some Realm method calling some System.Linq method and when we adjusted the Realm code we got it via CSharpMath calling System.Linq. So System.Linq seems to be involved in all cases.

@jkotas
Copy link
Member

jkotas commented Jan 31, 2024

Is this looking like a dotnet/runtime bug?

Based on #97661 (comment), this looks like a stackoverflow in the app main thread. Can you check the full stack and stack size of the crashing thread?

two other reports recently (see linked item immediately above) that also involved ios, gc, release mode, System.Linq, and write barriers of some form, although they were on MonoAOT not NativeAOT

These two other reports do not look related to this issue.

System.Linq seems to be involved in all cases.

System.Linq is a lot of complicated code. It is not unusual for System.Linq to hit bugs that no other code hits.

@jkotas
Copy link
Member

jkotas commented Jan 31, 2024

The error reporting for stackoverflow is not implemented in native AOT (tracked byhttps://github.com//issues/82334). Better error reporting would not fix the crash that you are hitting. It would just a produce a better error message for it if it is a stackoverflow.

@charlesroddie
Copy link

charlesroddie commented Feb 20, 2024

We weren't able to get any useful diagnostics such as a full stack or stack size, but through trial and error we believe we tracked this down to use of SKMetalView (mono/SkiaSharp#2762) and we confirmed the issue is unrelated to NativeAOT. Thanks for the advice here.

@rolfbjarne can you close this issue?

@jkotas jkotas closed this as completed Feb 20, 2024
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Feb 20, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Mar 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

No branches or pull requests

5 participants