Open savv opened 10 months ago
Yet another mitigation could be to sql_interrupt, prior to calling close_v2 from osp::clearState()
. If I understood correctly, this should make all pending transactions terminate synchronously, and before the runtime disappears.
I took a bit more, but managed to fix the crash when reloading the bundle via react-native-restart. You can give it a try with Codepush and let me know if it works. For now, I will stop spamming margelo since quick-sqlite belongs to them now.
https://github.com/OP-Engineering/op-sqlite/releases/tag/1.0.11
Hi Franco, many thanks for addressing this issue! That's a very thorough fix. Just one suggestion.
This comment is no longer accurate in my opinion:
// In certain cases, this will return SQLITE_OK, mark the database connection as an unusable "zombie",
// and deallocate the connection later.
It could be replace with sth like: "Calling sqlite3_interrupt will cause all pending (async) execution threads to immediately throw SQLITE_INTERRUPT and sqlite3_close_v2 to return immediately with SQLITE_OK."
I've noticed that the sqlite lib crashes when codepush restarts the app, if there are a pending async queries.
The reason is that it tries to use a runtime that doesn't exist anymore, crashing here.
I had previously tried to mitigate this issue with https://github.com/margelo/react-native-quick-sqlite/pull/16. While correct, it still allows pending executions to complete, causing these crashes.
One way to fix this is to kill ThreadPool's threads from
osp::clearState()
.@ospfranco any thoughts?
Full stack trace