Automattic / Automattic-Tracks-iOS

Client library for tracking user events for later analysis
GNU General Public License v2.0
41 stars 12 forks source link

TracksPersistentStoreException - Error initializing Tracks: Error Domain=NSSQLiteErrorDomain #209

Open iamgabrielma opened 2 years ago

iamgabrielma commented 2 years ago

I'm not entirely sure if this is coming from the AutomatticTracks pod or is something else in the WCiOS implementation, as the crash seemed to happen when attempting to create the persistentStoreCoordinator, but this last bit in the stack trace caught my attention:

if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error]) {
  // Replace this with code to handle the error appropriately.
  // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
    TracksLogError(@"Unresolved error %@, %@", error, [error userInfo]);

    @throw [NSException exceptionWithName:TracksPersistentStoreException
                                           reason:[NSString stringWithFormat:@"Error initializing Tracks: %@", error]
                                         userInfo:error.userInfo];
}
TracksPersistentStoreException
Error initializing Tracks: Error Domain=NSSQLiteErrorDomain Code=13 "(null)" UserInfo={NSFilePath=/var/mobile/Containers/Data/Application/425A1933-DC91-4E12-9739-A08822A585D0/Library/Application Support/com.automattic.woocommerce/Tracks.sqlite, NSSQLiteErrorDomain=13}

I checked a bit and seems to point to a "not enough memory" error, however the logs show Free Memory of 324.5 MiB at the time of the crash, which should be enough from my tests 🤔

Sentry Issue: WOOCOMMERCE-IOS-1DHC