Skip to content

How to debug "database is locked" errors? #3343

Closed Answered by simolus3
mrclauss asked this question in Q&A
Discussion options

You must be logged in to vote

Does this happen frequently? Are you opening the same drift isolate on multiple isolates? Or do you have one connection in drift and one outside of drift (including native code with your app possibly accessing the database)?

This should not happen when using a database with drift alone because drift has an internal async lock for the database. But if you're opening the same database file multiple times, there might be conflicts. Unfortunately I'm not a way to debug these issues (or printing where the lock was obtained). So the first step is determining where the database is opened and where it might be used concurrently.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by mrclauss
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants