CocoaLumberjack icon indicating copy to clipboard operation
CocoaLumberjack copied to clipboard

Crash cased by 0xdead10cc exception

Open cherpake opened this issue 6 months ago • 33 comments

I know that it seems that crash was caused by thread 0 from the crash reports (attached) but from what I see this code 0xdead10cc refers to holding file lock too long and in both crashes its DDLog that locking the file. https://forums.developer.apple.com/forums/thread/126438

Checklist

Describe the bug App crashes when its in the background and tries to log to file.

To Reproduce

NSFileManager* fileManager = [NSFileManager defaultManager];
    NSURL* containerUrl = [fileManager containerURLForSecurityApplicationGroupIdentifier:@"group.com.cherpake.macrc"];
    NSString* logsDirectory = [[containerUrl path] stringByAppendingPathComponent:@"AppLogs"];
    // Create this folder in case it doesn't exists
    [fileManager createDirectoryAtPath:logsDirectory withIntermediateDirectories:YES attributes:nil error:nil];
    id<DDLogFileManager> logFileManager = [[DDLogFileManagerDefault alloc] initWithLogsDirectory:logsDirectory];
    _fileLogger = [[DDFileLogger alloc] initWithLogFileManager:logFileManager];
    _fileLogger.maximumFileSize = (5 * 1024 * 1024); // 1MB KByte
    _fileLogger.logFileManager.maximumNumberOfLogFiles = 3;
    [DDLog addLogger:_fileLogger];

then create a thread that runs in the background and logs to file

Expected behavior Shouldn't crash

iOS 17.5.1 crash report

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Incident Identifier: 4AD0298E-5A66-4064-9629-D5752A5EA785
Beta Identifier:     BC0315B1-A32E-4973-A038-57B2671863BD
Hardware Model:      iPhone15,3
Process:             Remote•Pro [7996]
Path:                /private/var/containers/Bundle/Application/120A8D3A-794C-4F81-BA4F-22B69B90DD8D/Remote•Pro.app/Remote•Pro
Identifier:          com.cherpake.macrc.adsfree
Version:             2024.32 (24716)
AppStoreTools:       15F31e
AppVariant:          1:iPhone15,3:17.4
Beta:                YES
Code Type:           ARM-64 (Native)
Role:                unknown
Parent Process:      launchd [1]
Coalition:           com.cherpake.macrc.adsfree [2127]

Date/Time:           2024-08-05 12:58:12.3130 +0300
Launch Time:         2024-08-04 22:37:12.7381 +0300
OS Version:          iPhone OS 17.5.1 (21F90)
Release Type:        User
Baseband Version:    2.60.02
Report Version:      104

Exception Type:  EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: RUNNINGBOARD 3735883980 

Triggered by Thread:  0

Thread 0 name:   Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib        	       0x1de5f8808 mach_msg2_trap + 8
1   libsystem_kernel.dylib        	       0x1de5fc008 mach_msg2_internal + 80
2   libsystem_kernel.dylib        	       0x1de5fbf20 mach_msg_overwrite + 436
3   libsystem_kernel.dylib        	       0x1de5fbd60 mach_msg + 24
4   CoreFoundation                	       0x195518f5c __CFRunLoopServiceMachPort + 160
5   CoreFoundation                	       0x195518600 __CFRunLoopRun + 1208
6   CoreFoundation                	       0x195517cd8 CFRunLoopRunSpecific + 608
7   GraphicsServices              	       0x1da3c81a8 GSEventRunModal + 164
8   UIKitCore                     	       0x197b5090c -[UIApplication _run] + 888
9   UIKitCore                     	       0x197c049d0 UIApplicationMain + 340
10  Remote•Pro                    	       0x104a5394c 0x104a24000 + 194892
11  dyld                          	       0x1b8bc9e4c start + 2240

Thread 1 name:  com.apple.uikit.eventfetch-thread
Thread 1:
0   libsystem_kernel.dylib        	       0x1de5f8808 mach_msg2_trap + 8
1   libsystem_kernel.dylib        	       0x1de5fc008 mach_msg2_internal + 80
2   libsystem_kernel.dylib        	       0x1de5fbf20 mach_msg_overwrite + 436
3   libsystem_kernel.dylib        	       0x1de5fbd60 mach_msg + 24
4   CoreFoundation                	       0x195518f5c __CFRunLoopServiceMachPort + 160
5   CoreFoundation                	       0x195518600 __CFRunLoopRun + 1208
6   CoreFoundation                	       0x195517cd8 CFRunLoopRunSpecific + 608
7   Foundation                    	       0x194438e4c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
8   Foundation                    	       0x194438c9c -[NSRunLoop(NSRunLoop) runUntilDate:] + 64
9   UIKitCore                     	       0x197b64640 -[UIEventFetcher threadMain] + 420
10  Foundation                    	       0x19444f718 __NSThread__start__ + 732
11  libsystem_pthread.dylib       	       0x1f23a106c _pthread_start + 136
12  libsystem_pthread.dylib       	       0x1f239c0d8 thread_start + 8

Thread 2 name:  com.apple.NSURLConnectionLoader
Thread 2:
0   libsystem_kernel.dylib        	       0x1de5f8808 mach_msg2_trap + 8
1   libsystem_kernel.dylib        	       0x1de5fc008 mach_msg2_internal + 80
2   libsystem_kernel.dylib        	       0x1de5fbf20 mach_msg_overwrite + 436
3   libsystem_kernel.dylib        	       0x1de5fbd60 mach_msg + 24
4   CoreFoundation                	       0x195518f5c __CFRunLoopServiceMachPort + 160
5   CoreFoundation                	       0x195518600 __CFRunLoopRun + 1208
6   CoreFoundation                	       0x195517cd8 CFRunLoopRunSpecific + 608
7   CFNetwork                     	       0x1966f8c90 0x1965fb000 + 1039504
8   Foundation                    	       0x19444f718 __NSThread__start__ + 732
9   libsystem_pthread.dylib       	       0x1f23a106c _pthread_start + 136
10  libsystem_pthread.dylib       	       0x1f239c0d8 thread_start + 8

Thread 3 name:  com.apple.CFSocket.private
Thread 3:
0   libsystem_kernel.dylib        	       0x1de600474 __select + 8
1   CoreFoundation                	       0x195583b7c __CFSocketManager + 640
2   libsystem_pthread.dylib       	       0x1f23a106c _pthread_start + 136
3   libsystem_pthread.dylib       	       0x1f239c0d8 thread_start + 8

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

Thread 5 name:   Dispatch queue: cocoa.lumberjack
Thread 5:
0   libsystem_kernel.dylib        	       0x1de5fed0c __ulock_wait + 8
1   libdispatch.dylib             	       0x19d3ee7c4 _dlock_wait + 56
2   libdispatch.dylib             	       0x19d3eeb90 _dispatch_group_wait_slow + 56
3   CocoaLumberjack               	       0x104e25560 -[DDLog lt_log:] + 344
4   CocoaLumberjack               	       0x104e2438c __40-[DDLog queueLogMessage:asynchronously:]_block_invoke + 32
5   libdispatch.dylib             	       0x19d3ec13c _dispatch_call_block_and_release + 32
6   libdispatch.dylib             	       0x19d3eddd4 _dispatch_client_callout + 20
7   libdispatch.dylib             	       0x19d3f5400 _dispatch_lane_serial_drain + 748
8   libdispatch.dylib             	       0x19d3f5f30 _dispatch_lane_invoke + 380
9   libdispatch.dylib             	       0x19d400cb4 _dispatch_root_queue_drain_deferred_wlh + 288
10  libdispatch.dylib             	       0x19d400528 _dispatch_workloop_worker_thread + 404
11  libsystem_pthread.dylib       	       0x1f239f934 _pthread_wqthread + 288
12  libsystem_pthread.dylib       	       0x1f239c0cc start_wqthread + 8

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

Thread 7:
0   libsystem_pthread.dylib       	       0x1f239c0c4 start_wqthread + 0

Thread 8:
0   libsystem_pthread.dylib       	       0x1f239c0c4 start_wqthread + 0

Thread 9:
0   libsystem_pthread.dylib       	       0x1f239c0c4 start_wqthread + 0

Thread 10 name:   Dispatch queue: cocoa.lumberjack.fileLogger
Thread 10:
0   libsystem_kernel.dylib        	       0x1de5fce5c write + 8
1   Foundation                    	       0x1944949d8 _NSWriteToFileDescriptorWithProgress + 200
2   Foundation                    	       0x1944948d4 __34-[NSConcreteFileHandle writeData:]_block_invoke + 80
3   Foundation                    	       0x19438200c -[NSData(NSData) enumerateByteRangesUsingBlock:] + 120
4   Foundation                    	       0x194392098 -[NSConcreteFileHandle writeData:] + 196
5   Foundation                    	       0x19438f390 -[NSConcreteFileHandle writeData:error:] + 36
6   CocoaLumberjack               	       0x104e2232c -[DDFileLogger(Internal) lt_logData:] + 316
7   CocoaLumberjack               	       0x104e21cec -[DDFileLogger logMessage:] + 52
8   CocoaLumberjack               	       0x104e256b4 __16-[DDLog lt_log:]_block_invoke + 36
9   libdispatch.dylib             	       0x19d3ec13c _dispatch_call_block_and_release + 32
10  libdispatch.dylib             	       0x19d3eddd4 _dispatch_client_callout + 20
11  libdispatch.dylib             	       0x19d3f54d0 _dispatch_lane_serial_drain + 956
12  libdispatch.dylib             	       0x19d3f5f30 _dispatch_lane_invoke + 380
13  libdispatch.dylib             	       0x19d400cb4 _dispatch_root_queue_drain_deferred_wlh + 288
14  libdispatch.dylib             	       0x19d400528 _dispatch_workloop_worker_thread + 404
15  libsystem_pthread.dylib       	       0x1f239f934 _pthread_wqthread + 288
16  libsystem_pthread.dylib       	       0x1f239c0cc start_wqthread + 8

Thread 11:
0   libsystem_pthread.dylib       	       0x1f239c0c4 start_wqthread + 0

iOS 18 beta 4 crash report

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Incident Identifier: 6D70BDBE-0C28-4E94-83CF-08840986FB24
Beta Identifier:     BC0315B1-A32E-4973-A038-57B2671863BD
Hardware Model:      iPhone15,3
Process:             Remote•Pro [11492]
Path:                /private/var/containers/Bundle/Application/06151F24-E02A-44EB-A256-6CDFEFC68C06/Remote•Pro.app/Remote•Pro
Identifier:          com.cherpake.macrc.adsfree
Version:             2024.33 (24720)
AppStoreTools:       15F31e
AppVariant:          1:iPhone15,3:17.4
Beta:                YES
Code Type:           ARM-64 (Native)
Role:                unknown
Parent Process:      launchd [1]
Coalition:           com.cherpake.macrc.adsfree [5406]

Date/Time:           2024-08-10 21:14:51.0946 +0300
Launch Time:         2024-08-10 19:48:05.1101 +0300
OS Version:          iPhone OS 18.0 (22A5326f)
Release Type:        Beta
Baseband Version:    3.02.06
Report Version:      104

Exception Type:  EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: RUNNINGBOARD 3735883980 

Triggered by Thread:  0

Thread 0 name:   Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib        	       0x1ecd6f708 mach_msg2_trap + 8
1   libsystem_kernel.dylib        	       0x1ecd72e18 mach_msg2_internal + 80
2   libsystem_kernel.dylib        	       0x1ecd72d30 mach_msg_overwrite + 424
3   libsystem_kernel.dylib        	       0x1ecd72b7c mach_msg + 24
4   CoreFoundation                	       0x19cce87cc __CFRunLoopServiceMachPort + 160
5   CoreFoundation                	       0x19cce7e78 __CFRunLoopRun + 1212
6   CoreFoundation                	       0x19cce75b8 CFRunLoopRunSpecific + 572
7   GraphicsServices              	       0x1e89ef1c4 GSEventRunModal + 164
8   UIKitCore                     	       0x19f846da0 -[UIApplication _run] + 816
9   UIKitCore                     	       0x19f8f517c UIApplicationMain + 340
10  Remote•Pro                    	       0x10441b94c 0x1043ec000 + 194892
11  dyld                          	       0x1c27dcd34 start + 2724

Thread 1 name:  com.apple.uikit.eventfetch-thread
Thread 1:
0   libsystem_kernel.dylib        	       0x1ecd6f708 mach_msg2_trap + 8
1   libsystem_kernel.dylib        	       0x1ecd72e18 mach_msg2_internal + 80
2   libsystem_kernel.dylib        	       0x1ecd72d30 mach_msg_overwrite + 424
3   libsystem_kernel.dylib        	       0x1ecd72b7c mach_msg + 24
4   CoreFoundation                	       0x19cce87cc __CFRunLoopServiceMachPort + 160
5   CoreFoundation                	       0x19cce7e78 __CFRunLoopRun + 1212
6   CoreFoundation                	       0x19cce75b8 CFRunLoopRunSpecific + 572
7   Foundation                    	       0x19b982ec0 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
8   Foundation                    	       0x19b982d10 -[NSRunLoop(NSRunLoop) runUntilDate:] + 64
9   UIKitCore                     	       0x19f85a1f4 -[UIEventFetcher threadMain] + 420
10  Foundation                    	       0x19b994018 __NSThread__start__ + 724
11  libsystem_pthread.dylib       	       0x22405437c _pthread_start + 136
12  libsystem_pthread.dylib       	       0x22404f494 thread_start + 8

Thread 2 name:  com.apple.CFSocket.private
Thread 2:
0   libsystem_kernel.dylib        	       0x1ecd772b4 __select + 8
1   CoreFoundation                	       0x19cd514c0 __CFSocketManager + 704
2   libsystem_pthread.dylib       	       0x22405437c _pthread_start + 136
3   libsystem_pthread.dylib       	       0x22404f494 thread_start + 8

Thread 3 name:  com.apple.NSURLConnectionLoader
Thread 3:
0   libsystem_kernel.dylib        	       0x1ecd6f708 mach_msg2_trap + 8
1   libsystem_kernel.dylib        	       0x1ecd72e18 mach_msg2_internal + 80
2   libsystem_kernel.dylib        	       0x1ecd72d30 mach_msg_overwrite + 424
3   libsystem_kernel.dylib        	       0x1ecd72b7c mach_msg + 24
4   CoreFoundation                	       0x19cce87cc __CFRunLoopServiceMachPort + 160
5   CoreFoundation                	       0x19cce7e78 __CFRunLoopRun + 1212
6   CoreFoundation                	       0x19cce75b8 CFRunLoopRunSpecific + 572
7   CFNetwork                     	       0x19e265f44 +[__CFN_CoreSchedulingSetRunnable _run:] + 416
8   Foundation                    	       0x19b994018 __NSThread__start__ + 724
9   libsystem_pthread.dylib       	       0x22405437c _pthread_start + 136
10  libsystem_pthread.dylib       	       0x22404f494 thread_start + 8

Thread 4 name:   Dispatch queue: cocoa.lumberjack.fileLogger
Thread 4:
0   libsystem_kernel.dylib        	       0x1ecd73ca0 write + 8
1   Foundation                    	       0x19b9d072c _NSWriteToFileDescriptorWithProgress + 200
2   Foundation                    	       0x19b9d0624 __34-[NSConcreteFileHandle writeData:]_block_invoke + 80
3   Foundation                    	       0x19b8dc558 -[NSData(NSData) enumerateByteRangesUsingBlock:] + 120
4   Foundation                    	       0x19b8ec18c -[NSConcreteFileHandle writeData:] + 196
5   Foundation                    	       0x19b8e970c -[NSConcreteFileHandle writeData:error:] + 36
6   CocoaLumberjack               	       0x10474232c -[DDFileLogger(Internal) lt_logData:] + 316
7   CocoaLumberjack               	       0x104741cec -[DDFileLogger logMessage:] + 52
8   CocoaLumberjack               	       0x1047456b4 __16-[DDLog lt_log:]_block_invoke + 36
9   libdispatch.dylib             	       0x1a4968370 _dispatch_call_block_and_release + 32
10  libdispatch.dylib             	       0x1a496a0d0 _dispatch_client_callout + 20
11  libdispatch.dylib             	       0x1a49717a8 _dispatch_lane_serial_drain + 952
12  libdispatch.dylib             	       0x1a49721e0 _dispatch_lane_invoke + 380
13  libdispatch.dylib             	       0x1a497d258 _dispatch_root_queue_drain_deferred_wlh + 288
14  libdispatch.dylib             	       0x1a497caa4 _dispatch_workloop_worker_thread + 540
15  libsystem_pthread.dylib       	       0x224052c7c _pthread_wqthread + 288
16  libsystem_pthread.dylib       	       0x22404f488 start_wqthread + 8

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

Thread 6 name:   Dispatch queue: cocoa.lumberjack
Thread 6:
0   libsystem_kernel.dylib        	       0x1ecd75b50 __ulock_wait + 8
1   libdispatch.dylib             	       0x1a496aac0 _dlock_wait + 56
2   libdispatch.dylib             	       0x1a496ae90 _dispatch_group_wait_slow + 56
3   CocoaLumberjack               	       0x104745560 -[DDLog lt_log:] + 344
4   CocoaLumberjack               	       0x10474438c __40-[DDLog queueLogMessage:asynchronously:]_block_invoke + 32
5   libdispatch.dylib             	       0x1a4968370 _dispatch_call_block_and_release + 32
6   libdispatch.dylib             	       0x1a496a0d0 _dispatch_client_callout + 20
7   libdispatch.dylib             	       0x1a49716d8 _dispatch_lane_serial_drain + 744
8   libdispatch.dylib             	       0x1a49721e0 _dispatch_lane_invoke + 380
9   libdispatch.dylib             	       0x1a497d258 _dispatch_root_queue_drain_deferred_wlh + 288
10  libdispatch.dylib             	       0x1a497caa4 _dispatch_workloop_worker_thread + 540
11  libsystem_pthread.dylib       	       0x224052c7c _pthread_wqthread + 288
12  libsystem_pthread.dylib       	       0x22404f488 start_wqthread + 8

Thread 7:
0   libsystem_pthread.dylib       	       0x22404f480 start_wqthread + 0

Thread 8:
0   libsystem_pthread.dylib       	       0x22404f480 start_wqthread + 0

Thread 9:
0   libsystem_pthread.dylib       	       0x22404f480 start_wqthread + 0

Thread 10:
0   libsystem_pthread.dylib       	       0x22404f480 start_wqthread + 0

cherpake avatar Aug 11 '24 13:08 cherpake