-
Crash in the iOS SDK
Hi everyone,
I've found a strange report in the crash logs of our app.
Code:
Crashed: com.apple.main-thread0 Lightstreamer_iOS_Client 0x1003db160 +[ComLightstreamerClientConstants initialize] + 16
1 libobjc.A.dylib 0x181a18fc8 _class_initialize + 800
2 libobjc.A.dylib 0x181a1f8f8 lookUpImpOrForward + 184
3 libobjc.A.dylib 0x181a29db8 _objc_msgSend_uncached_impcache + 56
4 Lightstreamer_iOS_Client 0x1003ec3fc ComLightstreamerClientSubscription_init__WithNSString_withNSStringArray_withNSStringArray_ + 1296
5 Lightstreamer_iOS_Client 0x1003eba28 ComLightstreamerClientSubscription_initWithNSString_withNSStringArray_withNSStringArray_ + 616
6 Lightstreamer_iOS_Client 0x1003eb778 -[ComLightstreamerClientSubscription initWithNSString:withNSStringArray:withNSStringArray:] + 13736
7 Lightstreamer_iOS_Client 0x1004101cc -[LSSubscription initWithSubscriptionMode:items:fields:] + 1824
8 RealMadrid 0x1000e78d0 specialized Feed.subscribe(FeedSubscription) -> () (Feed.swift)
9 RealMadrid 0x1000ae048 HomeViewController.viewDidLoad() -> () (HomeViewController.swift)
10 RealMadrid 0x1000ae094 @objc HomeViewController.viewDidLoad() -> () (HomeViewController.swift)
11 UIKit 0x18709c0c0 -[UIViewController loadViewIfRequired] + 996
12 UIKit 0x18715bda8 -[UINavigationController _layoutViewController:] + 72
13 UIKit 0x18715bc80 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 416
14 UIKit 0x18715aec8 -[UINavigationController _startTransition:fromViewController:toViewController:] + 144
15 UIKit 0x18715aa6c -[UINavigationController _startDeferredTransitionIfNeeded:] + 868
16 UIKit 0x18715a694 -[UINavigationController __viewWillLayoutSubviews] + 60
17 UIKit 0x18715a5fc -[UILayoutContainerView layoutSubviews] + 208
18 UIKit 0x187097778 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 656
19 QuartzCore 0x184aa6b2c -[CALayer layoutSublayers] + 148
20 QuartzCore 0x184aa1738 CA::Layer::layout_if_needed(CA::Transaction*) + 292
21 QuartzCore 0x184aa15f8 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
22 QuartzCore 0x184aa0c94 CA::Context::commit_transaction(CA::Transaction*) + 252
23 QuartzCore 0x184aa09dc CA::Transaction::commit() + 512
24 QuartzCore 0x184a9a0cc CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 80
25 CoreFoundation 0x182360588 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
26 CoreFoundation 0x18235e32c __CFRunLoopDoObservers + 372
27 CoreFoundation 0x18228d6a0 CFRunLoopRunSpecific + 416
28 UIKit 0x18710a580 -[UIApplication _run] + 460
29 UIKit 0x187104d90 UIApplicationMain + 204
30 RealMadrid 0x100080ec4 main (MatchEvent+CoreDataProperties.swift:16)
31 libdispatch.dylib 0x181e2e8b8 (Missing)
That occurred 17 times for a single user, so it seems quite deterministic. The device is an iPhone 5s with iOS 9.2.1. Any idea on what it could be?
Thanks in advance!
-
Hello,
a couple of questions to better understand the problem:
- Which version of the iOS SDK are you using?
- What arguments are you passing to LSSubscription initWithSubscriptionMode:items:fields?
Best regards,
Gianluca
-
Hi Gianluca,
I'm using the 2.1.2 version of the unified library.
I'm passing "COMMAND", ["news"] and ["key","command", "type", "timestampUTC", "data"]. Anyway I don't think the problem is on the arguments as we have thousands of users with no crash at all.
Thank you.
-
This crash is quite puzzling. We weren't able to reproduce it, even under extreme concurrency conditions.
Is there any other information you want to share with us to help track it down? E.g.:
- Other libraries linked to the app.
- If you noticed concomitant side conditions like memory warnings, awake from sleep of the app, etc.
- If you make use of special techniques like method swizzling.
If you prefer not to share publicly this kind of information, you can contact support@lightstreamer.com and we will continue the support thread via e-mail.
-
Hi,
actually nothing fancy. Could it be related to bad network conditions (e.g. high server loads)?
Emilio
-
I don't think so. It's actually crashing in the static initializer of a class of constants (!) needed by LSSubscription, so it happens before any subscription can be made. By that time it may have already connected though, or being in the process of connecting.
We tried both these scenarios multiple times, on the simulator and on a real device, but none of them led to crash. Unfortunately we don't have an iPhone 5s with iOS 9.2.1 to test in the exact same conditions.
The only hypothesis I can still think of is that a previous operation thrashed the memory (e.g. another thread wrote on a dangling pointer), and by accident it causes a crash int that point. It may sound improbable, but if the crash happens during startup, a repeatable sequence of operations may actually frequently lead to the same accidental crash. I've already seen it happen.
We could gather some more information from a detailed log of our client library. Do you have any way to enable logging and retrieve the log from this user's device? Logging may be enabled by adding the following line somewhere before you connect:
[LSLightstreamerClient setLoggerProvider:[[LSConsoleLoggerProvider alloc] initWithLevel:LSConsoleLogLevelDebug]];