Replies: 1 comment
-
|
Hi @seanmrich, surprisingly it seems that I'm not 100% certain of the fix right now. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
After adding a
SyncEngineto the bootstrap function in my app, I started getting "SQLite error 14: unable to open database" randomly scattered among my unit tests. I believe I've narrowed this down to the fact that SyncEngine isn't getting released so the file descriptors keep building up until the OS complains. The console output looks like this:Here's a simple one-file demo of the issue:
Ideally the SyncEngine would be released at the end of each loop, but instead they pile up until the error is produced. You get the same result when you do this across a similar number of individual tests instead of in a loop (it's just much slower). I also wrote this test to check the release of the engine:
In my testing,
closeDbpasses which means the sync engine is not released until the database is explicitly closed. Looking through the code it appears the leak may be related to the database functions registered insetUpSyncEngine(writableDB:). The sync engine retains the user database, the database retains the functions, and the functions capture self (the sync engine) giving you a retain cycle.Tested using the main branch of SQLiteData using Xcode 26.3.
Beta Was this translation helpful? Give feedback.
All reactions