Crash in com.apple.CFNetwork.CacheDB-write

We are seeing a crash in our app while coming out of background. The crash happens when the app is InTune protected. We also filed a ticket with Microsoft but since the crash is in CFNetwork, I am also filing a crash report here.

Incident Identifier: 16726110-58F2-40E9-A133-12F5D652C606 CrashReporter Key: 40194d1317e24baed9877d8fe177766e97e114ea Hardware Model: iPhone11,8 Process: Global Relay [6483] Path: /private/var/containers/Bundle/Application/C08AD02D-4949-4641-A512-F47E8B866258/Global Relay.app/Global Relay Identifier: com.globalrelay.gr-app-im Version: 2.9.0 (31150) Code Type: ARM-64 (Native) Role: Non UI Parent Process: launchd [1] Coalition: com.globalrelay.gr-app-im [609]

Date/Time: 2023-03-02 09:29:02.5119 -0800 Launch Time: 2023-03-02 09:27:56.4032 -0800 OS Version: iPhone OS 16.4 (20E5212f) Release Type: Beta Baseband Version: 5.02.01 Report Version: 104

Exception Type: EXC_BAD_ACCESS (SIGBUS) Exception Subtype: FS pagein error: 1 Operation not permitted Exception Codes: 0x000000000000000a, 0x0000000114dbc000 VM Region Info: 0x114dbc000 is in 0x114dbc000-0x114dc4000; bytes after start: 0 bytes before end: 32767 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL mapped file 114d0c000-114dbc000 [ 704K] r--/rw- SM=COW ...t_id=61d7d349 ---> mapped file 114dbc000-114dc4000 [ 32K] rw-/rw- SM=PRV ...t_id=60cee649 mapped file 114dc4000-114dcc000 [ 32K] r--/r-- SM=SHM ...t_id=60b73449 Termination Reason: SIGNAL 10 Bus error: 10 Terminating Process: exc handler [6483]

Triggered by Thread: 8

Kernel Triage: APFS - (arg = 0xffffffdc00200040) The inode's protection class does not allow pagein VM - (arg = 0x0) Filesystem pagein returned an error in vnode_pagein VM - (arg = 0x0) Page has error bit set

Thread 8 name: Dispatch queue: com.apple.CFNetwork.CacheDB-write Thread 8 Crashed: 0 libsqlite3.dylib 0x1e1d53cec 0x1e1d3b000 + 101612 1 libsqlite3.dylib 0x1e1d522c4 0x1e1d3b000 + 94916 2 libsqlite3.dylib 0x1e1d51ae0 0x1e1d3b000 + 92896 3 libsqlite3.dylib 0x1e1d50834 0x1e1d3b000 + 88116 4 libsqlite3.dylib 0x1e1d50248 0x1e1d3b000 + 86600 5 libsqlite3.dylib 0x1e1d67d24 0x1e1d3b000 + 183588 6 libsqlite3.dylib 0x1e1d66670 sqlite3_step + 984 7 libsqlite3.dylib 0x1e1d43544 sqlite3_exec + 352 8 CFNetwork 0x1bd633510 0x1bd5f0000 + 275728 9 CFNetwork 0x1bd6bebf8 0x1bd5f0000 + 846840 10 libdispatch.dylib 0x1c3aaffec _dispatch_block_async_invoke2 + 148 11 libdispatch.dylib 0x1c3aa0f48 _dispatch_client_callout + 20 12 libdispatch.dylib 0x1c3aa85d0 _dispatch_lane_serial_drain + 668 13 libdispatch.dylib 0x1c3aa913c _dispatch_lane_invoke + 436 14 libdispatch.dylib 0x1c3ab3cdc _dispatch_workloop_worker_thread + 648 15 libsystem_pthread.dylib 0x21c611ddc _pthread_wqthread + 288 16 libsystem_pthread.dylib 0x21c611b7c start_wqthread + 8

The crash happens when the app is InTune protected.

Ah, that probably explains something very strange about the crash report you posted. At the end of the binary images section I see this:

Binary Images:
    …
    0x0 - 0xffffffffffffffff ??? unknown-arch  <00000000000000000000000000000000> ???

which suggests that the process state has been mushed in some non-obvious way.

Are you able to test without that feature? And in that case do you ever see this problem?

I am also filing a crash report here.

To be clear, DevForums is not somewhere for filing bugs. See tip 1 in Quinn’s Top Ten DevForums Tips.

Oh, and while you’re there, check out tip 5 for info on how to include chunks of preformatted text so that the result is readable.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thanks Quinn. We do not see the crash if InTune features is turned off. I found a work around by forcing NSURLCache to use in memory cache only and I dont see this crash anymore. But now we are seeing a different crash, also under InTune:

Incident Identifier: 6400C4FE-FD18-4370-9E49-6955307AE2B4
Hardware Model:      iPhone12,5
Process:             Global Relay [24836]
Path:                /private/var/containers/Bundle/Application/70DEBAF8-99D4-4ADB-8ABB-E7A386D708A6/Global Relay.app/Global Relay
Identifier:          com.globalrelay.gr-app-im
Version:             2.9.0 (33231)
AppStoreTools:       14C17
AppVariant:          1:iPhone12,5:16
Beta:                YES
Code Type:           ARM-64 (Native)
Role:                Non UI
Parent Process:      launchd [1]
Coalition:           com.globalrelay.gr-app-im [2457]

Date/Time:           2023-02-23 15:40:48.0996 -0800
Launch Time:         2023-02-23 15:31:20.2067 -0800
OS Version:          iPhone OS 16.3 (20D47)
Release Type:        User
Baseband Version:    4.00.00
Report Version:      104

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Subtype: KERN_MEMORY_ERROR at 0x0000000102fb002c
Exception Codes: 0x000000000000000a, 0x0000000102fb002c
VM Region Info: 0x102fb002c is in 0x102fb0000-0x103044000;  bytes after start: 44  bytes before end: 606163
      REGION TYPE                 START - END      [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      MALLOC guard page        102fac000-102fb0000 [   16K] ---/rwx SM=ZER  
--->  mapped file              102fb0000-103044000 [  592K] r--/rw- SM=COW  ...t_id=f5eefeef
      __TEXT                   103044000-10304c000 [   32K] r-x/rwx SM=COW  ...eMAMSwiftStub
Termination Reason: SIGNAL 10 Bus error: 10
Terminating Process: exc handler [24836]

Triggered by Thread:  0


Kernel Triage:
VM - pmap_enter retried due to resource shortage
VM - pmap_enter retried due to resource shortage
VM - pmap_enter retried due to resource shortage
VM - pmap_enter retried due to resource shortage
VM - pmap_enter retried due to resource shortage


Thread 0 name:
Thread 0 Crashed:
0   dyld                          	0x00000001abad4518 dyld4::PrebuiltLoaderSet::objcClassOpt() const + 0 (PrebuiltLoader.cpp:1617)
1   dyld                          	0x00000001abad448c dyld4::APIs::_dyld_for_each_objc_class(char const*, void (void*, bool, bool*) block_pointer) + 48 (DyldAPIs.cpp:2190)
2   libobjc.A.dylib               	0x0000000186301ac8 getClass_impl(char const*) + 176 (objc-opt.mm:404)
3   libobjc.A.dylib               	0x00000001862fee5c getClassExceptSomeSwift(char const*) + 24 (objc-runtime-new.mm:1790)
4   libobjc.A.dylib               	0x00000001862fd77c look_up_class + 92 (objc-runtime-new.mm:7838)
5   Foundation                    	0x000000018750b970 NSClassFromString + 156 (NSObjCRuntime.m:0)
6   FrontBoardServices            	0x00000001a2ef1e94 +[FBSSceneClientSettingsDiff diffFromSettings:toSettings:] + 96 (FBSSceneClientSettingsDiff.m:27)
7   FrontBoardServices            	0x00000001a2ef19ac -[FBSScene _calloutQueue_comsumeLock_updateClientSettings:withTransitionContext:] + 128 (FBSScene.m:294)
8   FrontBoardServices            	0x00000001a2ef18ac -[FBSScene updateClientSettings:withTransitionContext:] + 128 (FBSScene.m:117)
9   FrontBoardServices            	0x00000001a2ef17fc -[FBSScene updateClientSettingsWithTransitionBlock:] + 116 (FBSScene.m:132)
10  FrontBoardServices            	0x00000001a2ef175c -[FBSScene updateClientSettingsWithBlock:] + 124 (FBSScene.m:122)
11  UIKitCore                     	0x000000018f423230 -[FBSScene(UIApp) updateUIClientSettingsWithBlock:] + 168 (FBSScene+UIApp.m:48)
12  UIKitCore                     	0x000000018f7219c4 -[UIApplication _setIdleTimerDisabled:forReason:] + 188 (UIApplication.m:1900)
13  Foundation                    	0x0000000187565308 __NSFireTimer + 96 (NSTimer.m:280)
14  CoreFoundation                	0x000000018d23d32c __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 32 (CFRunLoop.c:1797)
15  CoreFoundation                	0x000000018d1f99a8 __CFRunLoopDoTimer + 940 (CFRunLoop.c:2402)
16  CoreFoundation                	0x000000018d19d548 __CFRunLoopDoTimers + 288 (CFRunLoop.c:2560)
17  CoreFoundation                	0x000000018d1eafa0 __CFRunLoopRun + 1896 (CFRunLoop.c:3120)
18  CoreFoundation                	0x000000018d1efeb0 CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418)
19  GraphicsServices              	0x00000001c73e5368 GSEventRunModal + 164 (GSEvent.c:2196)
20  UIKitCore                     	0x000000018f6e5668 -[UIApplication _run] + 888 (UIApplication.m:3758)
21  UIKitCore                     	0x000000018f6e52cc UIApplicationMain + 340 (UIApplication.m:5348)
22                                	0x0000000103720b78 0x1034ac000 + 2575224
23                                	0x00000001023feac0 main + 640 (main.m:40)
24  dyld                          	0x00000001abae8960 start + 2528 (dyldMain.cpp:1170)

Sorry, post the reply too soon. The crash happened when the app is in the background for over an hour. We do have the app scheduled for background fetch every half an hour, without InTune it works well. I am not sure if this crash is related to the refresh, but it does have the setIdleTimerDisable call in the call stack. Was this part of the scheduled refresh triggered by OS? Thanks a lot for your help!

I think you need to talk to the InTune folks about this. You’re seeing mysterious crashes in unrelated parts of the OS when enabling there stuff. That’s not good.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Crash in com.apple.CFNetwork.CacheDB-write
 
 
Q