-
-
Notifications
You must be signed in to change notification settings - Fork 288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] EXC_BAD_ACCESS when called when app is in background using BGAppRefreshTask #631
Comments
Could it be the same issue as #567 ? |
Do you have the Data Protection entitlement set to something strict (e.g. |
Ouch... good hint @rdavisau But then, why does it crash the app this way? So changing this entitlement afterwards (once the app is already live) seems to be potentially problematic. As a matter of fact the introduction of Akavache hasn't been released yet (is about to be). Not too sure what my best options are from there. |
If you look at the stack trace it's not akavache but sqlite3 btw. |
Yeah the error is in SQLite - and I wouldn't really consider it to be a bug for either SQLite or Akavache. You can set the fileprotection flags for the SQLite files to be different from the rest of the app by using (Edit: obviously this means your cached data is not encrypted so think about whether that's OK for you. You can combine this with Akavache's own encryption support to maintain an encrypted cache without ios data protection) |
Ok so after a bit of digging, I can see that the 3 files are (at least in my case):
all stored at the following location: Looking through Akavache's source code, unless I'm missing something, I can see no way to instruct Akavache to create the db with specific The SqlConnection is created as follows: public SqlRawPersistentBlobCache(string databaseFile, IScheduler? scheduler = null)
{
Scheduler = scheduler ?? BlobCache.TaskpoolScheduler;
BlobCache.EnsureInitialized();
Connection = new SQLiteConnection(databaseFile, storeDateTimeAsTicks: true);
_initializer = Initialize();
} and the SQLiteConnection constructor used is not the one where we could have passed such flags: public SQLiteConnection(string databasePath, bool storeDateTimeAsTicks = false)
: this(databasePath, SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create, storeDateTimeAsTicks)
{
} The only ones passed are Which seems to leave me with at least 2 options:
Any thoughts / advice? Thanks |
Yep those files match with what I remember. I think either option is reasonable, although in the first case I would hardcode just the root folder and iterate the files underneath to apply the flags to. That's what I've done successfully in the past. |
If either of you end up coding a solution if you want to submit a pr to the readme I can merge it in. |
I implemented Akavache for storing many user & app related data locally.
This works well overall.
But it seems there is a scenario where the app regularly crashes (but not systematically).
I implemented the iOS14 BGAppRefreshTask, which works ok.
The task itself fetches some small data over the network and then saves some small amount of data using Akavache.
But sometimes, when the system executes the Task while the app is in background, the network call executes but then the app crashes, and it seems Akavache to be the culprit (because of the crashlog and also because I can see after relaunching the app that the data hasn't been saved as expected).
See the crash logs:
Environment
When I execute the exact same task while the app is active, it works 100% of the time flawlessly, with the exact same code.
Does this crashlog give any clue about something going wrong?
Thank you.
The text was updated successfully, but these errors were encountered: