"Database is locked" error
I have developed a small web project using Django as a backend. Recently I became to face "Database is locked" errors. And their frequency is growing over time. What can be the reason for these errors?
I have developed a small web project using Django as a backend. Recently I became to face "Database is locked" errors. And their frequency is growing over time. What can be the reason for these errors?
Can I ask you what the database are you using?
SQLite. This is a really small pet project.
But it is deployed and available to the public, yes?
Yes, people from my university knows about this site.
I think the reason is that your website is serving more users now than the lightweight database SQLite can support. The reason for "Database is locked" error is that one thread of execution wants to access the database but another thread is already using the database. This not allows the first thread to access the database. It waits for some time, but then it is timed out. Try to migrate to the more production-fit database, for example, PostgreSQL.
Thank you, but there is not so much traffic on my website. I am really surprised that it is a problem.
Then look at the timeout parameter, maybe it is set to an extremely low duration. Or maybe there are some other issues with your architecture. Something is done with the database for a long period of time, for example. Anyway, the eventual reason is that one thread wants to access the database which is already locked by another thread. Find the reason for this situation.
This is noted. Thank you!
Just drop us an email to ... Show more