You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dialect: sqliteFor issues and PRs. Things that involve SQLite (and do not involve all dialects).good first issueFor issues. An issue that is a good choice for first-time contributors.type: bugDEPRECATED: replace with the "bug" issue type
No, sequelize.close() with sqlite does nothing. sequelize.close() calls this.connectionManager.close() this.connectionManager.close() calls this.onProcessExit() this.onProcessExit() will do something only if this.pool is defined. But it's undefined for sqlite.
I can fix this one. As @francescoinfante said, we're not closing the connection because the current implementation of onProcessExit assumes that we are using pools:
onProcessExit() {
if (this.pool) {
this.pool.drain(() => {
debug('connection drain due to process exit');
this.pool.destroyAllNow();
});
}
}
As it stands today, the SqliteDialect class does not even make an attempt to use pools. I noticed #5914 makes it forbidden to not use pools. This PR doesn't mention how sqlite still does not have pooling support. And that's where I'm at a crossroads. I'm guessing it was an explicit decision not to support pooling for sqlite since the database isn't really designed for concurrent connections (is this an inaccurate statement? This suggests we can have concurrent connections)).
So is the solution to this issue to support pooling for sqlite anyway (maybe just limiting the number of connections to 1), giving us a common API for managing all SQL dialects? Or is it to add an exception in onProcessExit to handle sqlite a little bit differently? Or is it to support pooling with an unthrottled number of connections like every other DB?
Does anybody know if this bug could have caused a SQLITE_CORRUPT error? I.e. if a process was force quit during a database write or if the process was quit in the middle of a write?
We're on [email protected] (before this fix was merged), SQLCipher, and Electron and have a few users that have gotten SQLITE_CORRUPT. I'm wondering if their app was force quit somehow and the database connection wasn't closed properly, leaving the on-disk SQLite database in a corrupt state.
UPDATE: I don't think we're using WAL mode... unless Sequelize is doing that for us?
dialect: sqliteFor issues and PRs. Things that involve SQLite (and do not involve all dialects).good first issueFor issues. An issue that is a good choice for first-time contributors.type: bugDEPRECATED: replace with the "bug" issue type
Activity
felixfbecker commentedon Nov 3, 2016
Doesn't
sequelize.close()work for you?francescoinfante commentedon Nov 4, 2016
No,
sequelize.close()with sqlite does nothing.sequelize.close()callsthis.connectionManager.close()this.connectionManager.close()callsthis.onProcessExit()this.onProcessExit()will do something only ifthis.poolis defined. But it's undefined for sqlite.nadrane commentedon Dec 26, 2016
I can fix this one. As @francescoinfante said, we're not closing the connection because the current implementation of
onProcessExitassumes that we are using pools:As it stands today, the
SqliteDialectclass does not even make an attempt to use pools. I noticed #5914 makes it forbidden to not use pools. This PR doesn't mention how sqlite still does not have pooling support. And that's where I'm at a crossroads. I'm guessing it was an explicit decision not to support pooling for sqlite since the database isn't really designed for concurrent connections (is this an inaccurate statement? This suggests we can have concurrent connections)).So is the solution to this issue to support pooling for sqlite anyway (maybe just limiting the number of connections to 1), giving us a common API for managing all SQL dialects? Or is it to add an exception in
onProcessExitto handle sqlite a little bit differently? Or is it to support pooling with an unthrottled number of connections like every other DB?Deilan commentedon Sep 5, 2017
Not stale.
aguynamedben commentedon Apr 16, 2019
Does anybody know if this bug could have caused a SQLITE_CORRUPT error? I.e. if a process was force quit during a database write or if the process was quit in the middle of a write?
We're on [email protected] (before this fix was merged), SQLCipher, and Electron and have a few users that have gotten SQLITE_CORRUPT. I'm wondering if their app was force quit somehow and the database connection wasn't closed properly, leaving the on-disk SQLite database in a corrupt state.
UPDATE: I don't think we're using WAL mode... unless Sequelize is doing that for us?