-
Notifications
You must be signed in to change notification settings - Fork 190
Closed
Labels
A-sqliteArea: SQLite / deadpool-sqliteArea: SQLite / deadpool-sqlitebugCategory: This is a bug.Category: This is a bug.
Description
ConnectionWrapper wraps a rustqlite::Connection which implements a Drop that may perform synchronous I/O:
impl Drop for Connection {
#[inline]
fn drop(&mut self) {
self.flush_prepared_statement_cache();
}
}Thus, when (the last of the clones of) ConnectionWrapper is dropped, synchronous I/O will be performed in what is surely to be an async context. This is, of course, logically incorrect behavior that can lead to quite a few problems including panics.
In general, wrapping a synchronous connection correctly (or any other I/O object) is incredibly error-prone. Please see our implementation in rocket_sync_db_pools where we've painstakingly tried to address all of the relevant issues: https://github.com/SergioBenitez/Rocket/blob/693f4f9ee50057fc735e6e7037e6dee5b485ba10/contrib/sync_db_pools/lib/src/connection.rs.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-sqliteArea: SQLite / deadpool-sqliteArea: SQLite / deadpool-sqlitebugCategory: This is a bug.Category: This is a bug.