Alamofire: How to debug crash in SessionDelegate.urlSession(URLSession, dataTask : URLSessionDataTask, didReceive : Data)?
I’m seeing a fairly common EXC_BREAKPOINT
crash in Crashlytics caused by a delegate handler in Alamofire. See below for the stack trace. The app in question is iOS 10 only, and the crash seems to happen on all devices and 10.x versions.
Crashed: NSOperationQueue 0x170034f60 :: NSOperation 0x1708519a0 (QOS: DEFAULT)
0 libswiftFoundation.dylib 0x100dc2e4c static Data._unconditionallyBridgeFromObjectiveC(NSData?) -> Data (__hidden#3516_:1698)
1 Alamofire 0x10061388c @objc SessionDelegate.urlSession(URLSession, dataTask : URLSessionDataTask, didReceive : Data) -> () + 184
2 CFNetwork 0x185672b1c __67-[NSURLSession delegate_dataTask:didReceiveData:completionHandler:]_block_invoke.242 + 36
3 Foundation 0x185993fb0 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16
4 Foundation 0x1858d8aa8 -[NSBlockOperation main] + 96
5 Foundation 0x1858c90a4 -[__NSOperationInternal _start:] + 620
6 Foundation 0x18599635c __NSOQSchedule_f + 228
7 libdispatch.dylib 0x183d2e1bc _dispatch_client_callout + 16
8 libdispatch.dylib 0x183d3c3dc _dispatch_queue_serial_drain + 928
9 libdispatch.dylib 0x183d319a4 _dispatch_queue_invoke + 652
10 libdispatch.dylib 0x183d3e34c _dispatch_root_queue_drain + 572
11 libdispatch.dylib 0x183d3e0ac _dispatch_worker_thread3 + 124
12 libsystem_pthread.dylib 0x183f372a0 _pthread_wqthread + 1288
13 libsystem_pthread.dylib 0x183f36d8c start_wqthread + 4
Due to the crash being EXC_BREAKPOINT
I’m assuming it’s a failing assertion somewhere and may actually be happening in the Swift/Obj-C compatibility layer before the actual delegate code is even called. But I’m not sure how to debug this and was hoping someone on here has an idea why this would happen.
I use Alamofire for standard HTTPS requests to a JSON backend. I have one standard session manager and one background session manager. I’m setting the backgroundCompletionHandler
in the app delegate as well.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 2
- Comments: 44 (21 by maintainers)
Commits related to this issue
- Crash fix #2138 — committed to 2h4u/Alamofire by deleted user 5 years ago
- Crash fix #2138 — committed to 2h4u/Alamofire by deleted user 5 years ago
I’d rather have 100 warnings than a single crash…
@quietpixel There have been no new developments regarding this issue. It should be a rather rare crash from the underlying
URLSession
that Alamofire uses. Reporting the issue to Apple to duplicate the previously reported issues should help get it fixed on their end.