Crash on Error Code: -1001 Error: NSURLErrorTimedOut - ios

I am having the following crash (0.05% crash rate, so I have yet to reproduce it):
0 libdispatch.dylib 0x208b2028 _dispatch_semaphore_signal_slow + 174
! 1 MyProject 0x00253f39 __64-[CRNSURLSessionTaskProxy wrapDataCompletionHandler:forSession:]_block_invoke + 422
2 CFNetwork 0x2120796d __75-[__NSURLSessionLocal taskForClass:request:uploadFile:bodyData:completion:]_block_invoke + 14
3 CFNetwork 0x21216ef7 __49-[__NSCFLocalSessionTask _task_onqueue_didFinish]_block_invoke + 276
4 Foundation 0x2150a52d __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 6
5 Foundation 0x2146beff -[NSBlockOperation main] + 144
6 Foundation 0x2145e2ef -[__NSOperationInternal _start:] + 772
7 Foundation 0x2150c7ed __NSOQSchedule_f + 190
8 libdispatch.dylib 0x208adf97 _dispatch_queue_drain + 1760
9 libdispatch.dylib 0x208a6f2f _dispatch_queue_invoke + 280
10 libdispatch.dylib 0x208af325 _dispatch_root_queue_drain + 398
11 libdispatch.dylib 0x208af193 _dispatch_worker_thread3 + 92
12 libsystem_pthread.dylib 0x20a3ce0d _pthread_wqthread + 1022
13 libsystem_pthread.dylib 0x20a3c9fc start_wqthread + 6
The crashes only appears on iOS9, none whatsoever on iOS8, but this could just be a coincidence. I am also seeing this via Crittercism breadcrumbs:
I am also using Background Fetches which do hit the network layer.
Any idea why this is happing?

This looks to me like a bug with Crittercism. The class CRNSURLSessionTaskProxy is a Crittercism class (see below), so it's crashing in their code, which is corroborated by the errors in the Crittercism breadcrumbs.
The only Google hit (other than this question) for the class name is this one. If you look at the other classes in that dump that start with CR, you will see CRBreadcrumbs and CRCrash.
Also here's a dump of the Crittercism framework in the Hopper disassembler:
Pretty conclusive I would say.

Related

NSKeyValuePopPendingNotificationLocal Crash on iOS 13 and 14

I am getting a crash on the live app I am working on and I can't seem to recreate or find the issue. This is the crash output:
`Crashed: NSOperationQueue 0x123e7d5c0 (QOS: UNSPECIFIED)
0 libobjc.A.dylib 0x184a52198 objc_release + 104
1 Foundation 0x1850bd930 NSKeyValuePopPendingNotificationLocal + 60
2 Foundation 0x1850bd8ac NSKeyValueDidChange.llvm.947807775919258276 + 364
3 Foundation 0x1850bd2e0 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:] + 624
4 Foundation 0x18500cb1c -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey:key:key:usingBlock:] + 68
5 Foundation 0x1850b8eb8 _NSSetLongLongValueAndNotify + 284
6 CFNetwork 0x1880f4470 _CFNetworkHTTPConnectionCacheSetLimit + 205660
7 Foundation 0x1850d5410 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16
8 Foundation 0x184fdf138 -[NSBlockOperation main] + 100
9 Foundation 0x1850d7698 __NSOPERATION_IS_INVOKING_MAIN__ + 20
10 Foundation 0x184fdedd0 -[NSOperation start] + 732
11 Foundation 0x1850d8090 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 20
12 Foundation 0x1850d7b5c __NSOQSchedule_f + 180
13 libdispatch.dylib 0x18498f7dc _dispatch_block_async_invoke2 + 104
14 libdispatch.dylib 0x1849dd184 _dispatch_client_callout + 16
15 libdispatch.dylib 0x184985a3c _dispatch_continuation_pop$VARIANT$mp + 412
16 libdispatch.dylib 0x184985190 _dispatch_async_redirect_invoke + 600
17 libdispatch.dylib 0x184991fa4 _dispatch_root_queue_drain + 376
18 libdispatch.dylib 0x184992770 _dispatch_worker_thread2 + 128
19 libsystem_pthread.dylib 0x184a2cb48 _pthread_wqthread + 212
20 libsystem_pthread.dylib 0x184a2f760 start_wqthread + 8`
Please help me to figure out this thing. Thanks
It is caused by FirebasePerformance v3.3.1 and XCode 12. Use 'FirebasePerformance', '3.3.0' should solve the problem.
After setting FirebasePerformance to v3.3.0, we did not see any NSKeyValuePopPendingNotificationLocal, AFURLSessionManager, NSKVODeallocate, CFDictionaryGetValue, NSKeyValueWillChange, [NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:]... crashes anymore.
The crash-free percentage is recovered from 95% to 99.9%.
We removed Firebase Performance and since then we have not detected crashes anymore. The problem I think is due to Firebase Performance 3.3.1 with Xcode 12.
I have the same problem. My solution was to lower the version of Firebase. This problem should be caused by Firebase Performance

EXC_BREAKPOINT in RKManagedObjectRequestOperation NSManagedObjectContext::save

I'm getting this inconsistent, hard to reproduce crash in RestKit. The crash occurs on NSManagedObjectContext::save(), inside RKManagedObjectRequestOperation::saveContextToPersistentStore:failedContext:error (here's the exact line of code).
This crash happened to over a dozen different users in our production environment but I've personally been unable to reproduce it. I have no clue as to what might be causing this crash. My only clue is _forceRegisterLostFault which may suggest faulted/deleted objects are involved.
Background: RKManagedObjectRequestOperation::saveContextToPersistentStore:failedContext:error is invoked every time RestKit mapping is completed following a network request.
Has anyone encountered this particular EXC_BREAKPOINT in CoreData before?
Any suggestions on how to tackle this?
Stack trace:
Crashed: NSManagedObjectContext 0x1741cf5a0
0 CoreData 0x18add7c7c -[NSManagedObjectContext(_NSInternalAdditions) _forceRegisterLostFault:] + 160
1 CoreData 0x18ad5c8b0 -[NSManagedObjectContext(_NSInternalAdditions) _validateObjects:forOperation:error:exhaustive:forSave:] + 2884
2 CoreData 0x18ad5bcf8 -[NSManagedObjectContext(_NSInternalAdditions) _validateChangesForSave:] + 364
3 CoreData 0x18ad5b94c -[NSManagedObjectContext(_NSInternalChangeProcessing) _prepareForPushChanges:] + 196
4 CoreData 0x18ad51ec4 -[NSManagedObjectContext save:] + 544
5 RestKit 0x1013214b8 __84-[RKManagedObjectRequestOperation saveContextToPersistentStore:failedContext:error:]_block_invoke (RKManagedObjectRequestOperation.m:800)
6 CoreData 0x18add5b70 developerSubmittedBlockToNSManagedObjectContextPerform + 152
7 libdispatch.dylib 0x1878e91c0 _dispatch_client_callout + 16
8 libdispatch.dylib 0x1878f6860 _dispatch_barrier_sync_f_invoke + 84
9 CoreData 0x18add5a80 -[NSManagedObjectContext performBlockAndWait:] + 308
10 RestKit 0x1013212b8 -[RKManagedObjectRequestOperation saveContextToPersistentStore:failedContext:error:] (RKManagedObjectRequestOperation.m:808)
11 RestKit 0x1013216d0 -[RKManagedObjectRequestOperation saveContext:error:] (RKManagedObjectRequestOperation.m:831)
12 RestKit 0x101321f54 -[RKManagedObjectRequestOperation saveContext:] (RKManagedObjectRequestOperation.m:874)
13 RestKit 0x10131f654 __79-[RKManagedObjectRequestOperation performMappingOnResponseWithCompletionBlock:]_block_invoke.350 (RKManagedObjectRequestOperation.m:660)
14 RestKit 0x1013534a0 -[RKResponseMapperOperation willFinish] (RKResponseMapperOperation.m:323)
15 RestKit 0x101353ac4 -[RKResponseMapperOperation main] (RKResponseMapperOperation.m:411)
16 Foundation 0x1894578c4 -[__NSOperationInternal _start:] + 620
17 Foundation 0x189524b00 __NSOQSchedule_f + 228
18 libdispatch.dylib 0x1878e91c0 _dispatch_client_callout + 16
19 libdispatch.dylib 0x1878f7444 _dispatch_queue_serial_drain + 928
20 libdispatch.dylib 0x1878ec9a8 _dispatch_queue_invoke + 652
21 libdispatch.dylib 0x1878f938c _dispatch_root_queue_drain + 572
22 libdispatch.dylib 0x1878f90ec _dispatch_worker_thread3 + 124
23 libsystem_pthread.dylib 0x187af22b8 _pthread_wqthread + 1288
24 libsystem_pthread.dylib 0x187af1da4 start_wqthread + 4
There are a few different causes I've seen for this error.
Accessing Managed Objects and/or Contexts on the wrong thread. Use Core Data Concurrency Debugging to validate that you're always using the right thread, with the -com.apple.CoreData.ConcurrencyDebug 1 argument.
Corrupted Sqlite file - does your app include an out-of-box Core Data store? Make sure all the metadata in it is correct.
Overriding the default accessors in your Core Data Managed Objects. Be careful if you have objects with primitive (int or float instead of NSNumber) properties.

FMDBBlockSQLiteCallBackFunction Crash in app that's not using makeFunctionNamed

I'm working on an app that's in the app store, which uses FMDB for interacting with its sqlite database. We've received some crash reports with stack traces like this:
Thread : Crashed: NSOperationQueue 0x170239c20 :: NSOperation 0x17024d7d0 (QOS: LEGACY)
0 libobjc.A.dylib 0x000000019701c0b4 objc_retain + 20
1 MyApp 0x00000001002bdff4 FMDBBlockSQLiteCallBackFunction
2 MyApp 0x00000001002bdb1c FMDBBlockSQLiteCallBackFunction
3 MyApp 0x00000001002b66b4 FMDBBlockSQLiteCallBackFunction
4 MyApp 0x00000001002980fc FMDBBlockSQLiteCallBackFunction
5 MyApp 0x000000010029f20c FMDBBlockSQLiteCallBackFunction
6 CFNetwork 0x00000001851475a4 __49-[__NSCFLocalSessionTask _task_onqueue_didFinish]_block_invoke + 300
7 Foundation 0x00000001866bf1c4 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16
8 Foundation 0x0000000186610604 -[NSBlockOperation main] + 96
9 Foundation 0x00000001866001cc -[__NSOperationInternal _start:] + 636
10 Foundation 0x00000001866c1f28 __NSOQSchedule_f + 228
11 libdispatch.dylib 0x0000000197655954 _dispatch_client_callout + 16
12 libdispatch.dylib 0x00000001976600a4 _dispatch_queue_drain + 1448
13 libdispatch.dylib 0x0000000197658a5c _dispatch_queue_invoke + 132
14 libdispatch.dylib 0x0000000197662318 _dispatch_root_queue_drain + 720
15 libdispatch.dylib 0x0000000197663c4c _dispatch_worker_thread3 + 108
16 libsystem_pthread.dylib 0x000000019783522c _pthread_wqthread + 816
However, from reading the FMDB code it looks like FMDBBlockSQLiteCallBackFunction is only called as the callback for SQLite functions created using FMDatabase's makeFunctionNamed:maximumArguments:withBlock: method, which we're not using at all.
Any ideas what could be causing crashes like this?
The didFinish makes it look like you may have a race condition on this line:
6 CFNetwork 0x00000001851475a4 __49-[__NSCFLocalSessionTask _task_onqueue_didFinish]_block_invoke + 300
Try to emulate slow hardware to reproduce the end user’s state.

iOS app crashing in release but not in development and Swift symbols are not resolved

My app is working perfectly fine in development but switching to production / AdHoc release it crashes on the transition to the third UIViewController of my application flow.
Between the build there shouldn't be any difference. I have retrieved the log from the Devices window:
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001000d49ac
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 MYAPP 0x00000001000d49ac 0x100010000 + 805292
1 UIKit 0x00000001868a8954 -[UIViewController loadViewIfRequired] + 688
2 UIKit 0x00000001868a8664 -[UIViewController view] + 28
3 UIKit 0x0000000186f9c1cc -[_UIFullscreenPresentationController _setPresentedViewController:] + 72
4 UIKit 0x0000000186ba378c -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 116
5 UIKit 0x0000000186bbeb4c -[UIViewController _presentViewController:withAnimationController:completion:] + 1968
6 UIKit 0x0000000186bc0f64 __62-[UIViewController presentViewController:animated:completion:]_block_invoke + 116
7 UIKit 0x0000000186995c48 -[UIViewController presentViewController:animated:completion:] + 212
8 MYAPP 0x0000000100090dcc 0x100010000 + 527820
9 MYAPP 0x0000000100090bd0 0x100010000 + 527312
10 PromiseKit 0x000000010032a9f4 0x1002e8000 + 272884
11 PromiseKit 0x00000001002ee820 0x1002e8000 + 26656
12 libdispatch.dylib 0x00000001936c1990 _dispatch_call_block_and_release + 20
13 libdispatch.dylib 0x00000001936c1950 _dispatch_client_callout + 12
14 libdispatch.dylib 0x00000001936c6208 _dispatch_main_queue_callback_4CF + 1604
15 CoreFoundation 0x00000001820522e8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
16 CoreFoundation 0x0000000182050390 __CFRunLoopRun + 1488
17 CoreFoundation 0x0000000181f7d1f0 CFRunLoopRunSpecific + 392
18 GraphicsServices 0x000000018b39f6f8 GSEventRunModal + 164
19 UIKit 0x000000018690e108 UIApplicationMain + 1484
20 MYAPP 0x00000001000be820 0x100010000 + 714784
21 libdyld.dylib 0x00000001936eea04 start + 0
What is bugging me:
There is a clear inconsistency between the environments I am working on.
The calls from MYAPP doesn't seem to be linked to any component / method call. I'm working with Swift maybe it does cause problem to resolve symbols. Which could make sense since PromiseKit calls are also unresolved.
I have no idea about how to debug this, not even about how to put log everywhere (because I wouldn't know how to get them).
Any help is welcome!
In Build settings, try changing Swift compiler -> Optimization Level -> Release to None. There's still a bug where sometimes the compiler messes up closures when optimizations are on. Maybe that's what's happening to you.

iOS: Need help figuring out this crash "Crashed: NSOperationQueue Serial Queue EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x00000000"

This is the crash report I received from crashlytics and I don't have the slightest clue on what it means or what to do about this. Any tips or suggestions will be appreciated.
Thread : Crashed: NSOperationQueue Serial Queue
0 libsystem_platform.dylib 0x3baef4da _platform_memmove$VARIANT$Swift + 185
1 ??? 0x0000000c
2 DataDetectorsCore 0x350b26bb DDTokenCacheGetItemAtIndexCreateIfNeeded + 90
3 DataDetectorsCore 0x350b2635 DDTokenCacheGetTokensAtPosition + 1084
4 DataDetectorsCore 0x350ae41d _DDScannerHandleState + 472
5 DataDetectorsCore 0x350aea71 _DDScannerHandleState + 2092
6 DataDetectorsCore 0x350addf1 DDScannerScanQuery + 328
7 DataDetectorsUI 0x350c8f7d -[DDOperation main] + 288
8 Foundation 0x31664aa5 -[__NSOperationInternal _start:] + 772
9 Foundation 0x3170896d __NSOQSchedule_f + 60
10 libdispatch.dylib 0x3b9c5e7b _dispatch_queue_drain + 374
11 libdispatch.dylib 0x3b9c2f93 _dispatch_queue_invoke + 42
12 libdispatch.dylib 0x3b9c6745 _dispatch_root_queue_drain + 76
13 libdispatch.dylib 0x3b9c69c5 _dispatch_worker_thread2 + 56
14 libsystem_pthread.dylib 0x3baf0dff _pthread_wqthread + 298
Do you have any part of your app where the user clicks on a URL or specifies a URL which is then handled by your app, or by the system on behalf of your app. The subsystem that does this is DataDetectorsCore.
If you have code around that area, it would be a good idea to add log messages, assert checks, validation, and unit test code.
It might be that you are receiving maliciously crafted URLs; here is an example but for the Mac platform: http://nakedsecurity.sophos.com/2013/02/06/anatomy-of-a-bug-how-mac-os-x-chokes-if-you-type-file/

Resources