Troubleshooting a ‘Database is locked’ error message
How to resolve the “Database is Locked” error
Description
Issue
When attempting to access the Posit Connect homepage, users receive an error: “Database is locked.” The error message looks something like this:
Causes
This error often occurs when a server or its file system are under substantial load and the database is not able to serve requests to keep up with the demand. There are a number of causes for this issue. The most common are high CPU utilization or high database I/O.
Solution
Migrating database provider
Often with this error, SQLite has reached its limits, and it’s worth moving to an external database. Connect supports PostgreSQL as an alternative to its default SQLite.
Using a separate host dedicated to handling database transactions will improve performance. For information on migrating from the default SQLite database to PostgreSQL, see Changing database provider from the Connect Admin Guide. The PostgreSQL section of the Connect Admin Guide covers other information on configuring and using PostgreSQL.
Load balancing
Moving to a load-balanced Connect cluster requires the use of PostgreSQL. This does not address utilization issues on the hosts running Connect, but moves the database to a host where it is not affected.
For information on how to move to a high availability infrastructure setup with a load balancer, see Load balancing from the Connect Admin Guide.
Terminating processes
Killing processes risks data loss.
Another remediation is to check if there are any processes using excessive compute resources that are safe to remove. Check running processes by running the command below:
Terminal
top -o cpu -n 20Once identified, these processes can be removed:
Terminal
kill <processID>This may temporarily reduce the load on the database.