Closed philip511 closed 1 year ago
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
@philip511 do you have a full intact crash report? The error message in the title of this issue doesn't match the stack trace.
@philip511 do you have a full intact crash report? The error message in the title of this issue doesn't match the stack trace.
@morganchen12 For some reason Firebase Crashlytics does not report it in stack trace. This is what I see https://imgur.com/a/DzmxekQ
Here is the full stack trace that I downloaded from Crashlytics com.WeDivvy.WeDivvy_issue_a3452583de58f75dbf8d08c7cd553993_crash_session_30dbf59d92ef494ca8d6fe8c8c7c8cc1_DNE_0_v2_stacktrace.txt
@philip511 I don't see an obvious reason for error. What would be helpful:
@tom-andersen I'm so sorry I forgot to specify the line where it crashes. I updated my code and posted the line where it crashes below. I've played around with the code several times before posting here and it always seems to crash when doc.data is used. Whether it is being printed or being stored in a variable.
[[FIRCrashlytics crashlytics] logWithFormat:@"GetDataGetItemsInSpecificHome:%@ key:%@ doc:%@ doc.data:%@ Processing(4.4)", crashlyticsString, key, doc, doc.data];
However, the strange thing is this occurs randomly, the data being retrieved is not broken, I have checked. If it was broken the crash would occur over and over again, which it does not. This also doesn't crash right away, sometimes it crashes on the 3rd or 4th iteration of the outer for loop.
for (NSString *key in keyArray) {
This is very difficult to test, but I have a nagging suspicion that doc.data
method is invoked lazily by logging, perhaps after loop has exited and data has been released. If you convert doc.data
to string, and then pass that string to logger, does the problem disappear?
@tom-andersen Well, here is the thing. I don't really need to log it, I added those logs to see if I can find what's going wrong. This is my code without the logs. I'm trying to create a dictionary of arrays that looks like this. Also, as a side note I query this same data else where in the app and loop through it the same way as well, and no crash. I'm thinking it's some sort of memory or synchronization issue.
@{ @"ItemName" : @[@"A", @"B", @"C"], @"ItemID" : [@"1", @"2", @"3"] }
__block NSMutableDictionary *dataDict = [NSMutableDictionary dictionary];
FIRFirestore *defaultFirestore = [FIRFirestore firestore];
[[[defaultFirestore collectionWithPath:collection]
queryWhereField:@"ItemHomeID" isEqualTo:homeID] getDocumentsWithCompletion:^(FIRQuerySnapshot * _Nullable snapshot, NSError * _Nullable error) {
for (FIRDocumentSnapshot *doc in snapshot.documents) {
for (NSString *key in keyArray) {
NSMutableArray *arr = dataDict[key] ? [dataDict[key] mutableCopy] : [NSMutableArray array];
*****************************************Crash Occurs Here Because of doc.data*****************************
**************************************************************************************************************
id object = doc.data[key] ? doc.data[key] : [[[GeneralObject alloc] init] GenerateDefaultValueBasedOnKey:key];
*****************************************Crash Occurs Here Because of doc.data*****************************
**************************************************************************************************************
[arr addObject:object];
[dataDict setObject:arr forKey:key];
}
}
finishBlock(YES, dataDict);
}];
@philip511 Could you try to enable Address Sanitizer since there seems to be a null pointer problem. (see https://developer.apple.com/documentation/xcode/diagnosing-memory-thread-and-crash-issues-early)
We might get lucky and have the location of the problem identified.
@tom-andersen Got it, will do
Hey @philip511. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
@tom-andersen I'm sorry, I've never used Address Sanitizer, I'm trying to figure out how to use this to figure out my issue
@tom-andersen Do you have any tutorials on how to use Address Sanitizer? I enabled it but there was nothing useful showing in my debug view
@philip511 If it doesn't find any problems then the app will run as normal (although probably much slower!).
@philip511 you may find this Apple documentation helpful.
Hey @philip511. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
Since there haven't been any recent updates here, I am going to close this issue.
@philip511 if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.
Description
I am all out of ideas of what to do.
Reproducing the issue
No response
Firebase SDK Version
10.2.0
Xcode Version
14.1.0
Installation Method
CocoaPods
Firebase Product(s)
Analytics, Authentication, Crashlytics, Firestore, Functions, Storage
Targeted Platforms
iOS
Relevant Log Output
No response
If using Swift Package Manager, the project's Package.resolved
Expand
Package.resolved
snippet```json Replace this line with the contents of your Package.resolved. ```
If using CocoaPods, the project's Podfile.lock
Expand
Podfile.lock
snippet```yml # Uncomment the next line to define a global platform for your project platform :ios, '14.0' target 'WeDivvy' do # Comment the next line if you don't want to use dynamic frameworks use_frameworks! # Pods for WeDivvy ENV['SWIFT_VERSION'] = '5' pod 'Firebase/Core' pod 'Firebase/Crashlytics' pod 'Firebase/Database' pod 'Firebase/Analytics' pod 'Firebase/Auth' pod 'Firebase/Storage' pod 'Firebase/Messaging' pod 'Firebase/Firestore' pod 'Firebase/Functions' pod 'MRProgress' pod 'InstantSearch' pod 'InstantSearchClient' pod 'SDWebImage' pod 'Mixpanel' pod 'GoogleSignIn' end ```