-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
SqliteConnectOptions::new() doesn't set in_memory = true #3136
Comments
On second glance my pool timeout issue with The parsing code applies this logic for if database == ":memory:" {
options.in_memory = true;
options.shared_cache = true;
let seqno = IN_MEMORY_DB_SEQ.fetch_add(1, Ordering::Relaxed);
options.filename = Cow::Owned(PathBuf::from(format!("file:sqlx-in-memory-{seqno}")));
} // ... I can update the PR to include this logic in full, to make the instantiations equivalent. |
…hbadge#3137) * SqliteConnectOptions::filename() memory fix (launchbadge#3136) * Expose in_memory sqlite option * Docs SqliteConnectOptions::filename include mention of from_str alternative * Docs SqliteConnectOptions::filename typo fix
…hbadge#3137) * SqliteConnectOptions::filename() memory fix (launchbadge#3136) * Expose in_memory sqlite option * Docs SqliteConnectOptions::filename include mention of from_str alternative * Docs SqliteConnectOptions::filename typo fix
…hbadge#3137) * SqliteConnectOptions::filename() memory fix (launchbadge#3136) * Expose in_memory sqlite option * Docs SqliteConnectOptions::filename include mention of from_str alternative * Docs SqliteConnectOptions::filename typo fix
Bug Description
SqliteConnectOptions::filename()
doesn't setin_memory = true
, which caused me all sorts of connection pool deadlocking issues in a larger project. Pull request being filed shortly.Minimal Reproduction
Due to issue #2510 where in-memory SQLite databases appear to get wiped after being left idle for an extended period, I was doing a long-winded construction of the SqlitePool to use
max_connections(1)
as suggested.Switching to this instantiation started giving me all sorts of weird deadlocking issues with a larger project, which changed the point of failure on a specific test depending on which order a single-threaded tokio::test runtime executed. I sadly have not been able to reproduce the deadlocking and pool timeouts on a smaller example or diagnose where the deadlock occurs, but I can reliably fix them by using
SqliteConnectOptions::from_str(":memory:")
instead.Info
["macros", "sqlite", "uuid", "runtime-tokio", "chrono"]
rustc --version
: rustc 1.76.0 (07dca489a 2024-02-04)The text was updated successfully, but these errors were encountered: