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
{{ message }}
Repository navigation
Connecting to a locked database, message that looks like an error #197
Error in rsqlite_send_query(conn@ptr, statement) : database is locked
which is very misleading, because it does create the valid connection, and this is not really an error, just a message. I am not sure where it is coming from, maybe from the C client and then it is hard to fix. To reproduce, just create a DB from one process (or the shell), and lock it, then connect from another process:
❯ sqlite3 /tmp/xxx
SQLite version 3.8.5 2014-08-15 22:37:57
Enter ".help" for usage hints.
sqlite> BEGIN EXCLUSIVE;
library(DBI)
con<- dbConnect(RSQLite::SQLite(), "/tmp/xxx")
#> Error in rsqlite_send_query(conn@ptr, statement) : database is lockedcon#> <SQLiteConnection>#> Path: /private/tmp/xxx#> Extensions: TRUE
It's the try() calls in dbConnect(), a message that setting PRAGMA synchronous has failed should be printed instead. You can turn off the misleading message by asking dbConnect(synchronous = NULL) .
Writing is a tad slower. I wonder why setting the PRAGMA fails when the DB is locked; it's not documented whether the PRAGMA setting is persistent or connection-local.
I get the same error message, Couldn't set synchronous mode: database is locked
I am using a cluster of several thousands of core working out the SQLite. I am wondering where the Serialized option is available on RSQLite? See https://www.sqlite.org/threadsafe.html
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.
Activity
krlmlr commentedon Jan 9, 2017
It's the
try()calls indbConnect(), a message that settingPRAGMA synchronoushas failed should be printed instead. You can turn off the misleading message by askingdbConnect(synchronous = NULL).gaborcsardi commentedon Jan 9, 2017
Thanks!
gaborcsardi commentedon Jan 9, 2017
Btw. does this have any consequences, I mean, if setting the PRAGMA fails?
krlmlr commentedon Jan 9, 2017
Writing is a tad slower. I wonder why setting the PRAGMA fails when the DB is locked; it's not documented whether the PRAGMA setting is persistent or connection-local.
gaborcsardi commentedon Jan 9, 2017
I know some pragmas belong to the connection, e.g. the busy timeout.
But it seems that this one belongs to the database.
krlmlr commentedon Jan 9, 2017
That would mean that setting it for every connection is plain wrong. Do you have a reference?
gaborcsardi commentedon Jan 9, 2017
Yeah, I take it back. It does belong to the connection.
gaborcsardi commentedon Jan 9, 2017
I don't have a reference, just saw that it reverts back to the default if you close the connection that set it.
gaborcsardi commentedon Jan 9, 2017
Anyway, it seems that
RSQLitecannot really do much about this, except maybe give a better message.gaborcsardi commentedon Apr 4, 2017
👍
Merge tag 'v1.1-14'
Merge tag 'v2.0'
Hamedhm commentedon Jun 27, 2019
Hi
I get the same error message, Couldn't set synchronous mode: database is locked
I am using a cluster of several thousands of core working out the SQLite. I am wondering where the Serialized option is available on RSQLite? See https://www.sqlite.org/threadsafe.html
krlmlr commentedon Jul 7, 2019
I'm not sure if thread safety is an issue -- R is single-threaded. Either way, can you please open a new issue?
github-actions commentedon Dec 7, 2020
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.