Skip to main content
Version/Environment (if relevant): Applicable to all databases used within Domino deployments.

Issue:

A database lock occurs when a query or transaction blocks or stalls due to a lock conflict. This may appear in code execution or log messages, for example: Raw code sqlite3.OperationalError: database is locked

Root Cause:

Common causes of database locks include:
  • Concurrent data access — multiple processes try to read and write the same data simultaneously, requiring the database to serialize access
  • Long-running transactions — a transaction holds locks for an extended period, blocking other processes
  • Resource contention — multiple processes compete for limited disk or memory resources
  • Deadlocks — two or more processes each wait for the other to release a lock, creating a cycle that never resolves
  • Hardware or software failures — locks persist beyond a failure even after the failure itself resolves

Resolution:

MySQL Error messages: Raw code Deadlock found when trying to get lock Lock wait timeout exceeded; try restarting transaction Fix steps:
  1. Run SHOW PROCESSLIST to identify the process holding the lock.
Raw code SHOW PROCESSLIST;
  1. Terminate the blocking process using its process ID.
Raw code KILL <process_id>;
  1. If an open transaction is causing the lock, roll it back.
Raw code ROLLBACK; SQL Server Error message: Raw code Transaction (Process ID) was deadlocked on lock resources with another process and was chosen as the victim of the deadlock. Restart the transaction. Fix steps:
  1. Run sp_who2 to identify the blocking process.
Raw code EXEC sp_who2;
  1. Terminate the blocking process using its process ID.
Raw code KILL <process_id>;
  1. If an open transaction is causing the lock, roll it back.
Raw code ROLLBACK; SQLite Error message: Raw code sqlite3.OperationalError: database is locked Fix steps:
  1. Commit any open transaction.
Raw code conn.commit()
  1. Close the connection to release the lock.
Raw code conn.close()
  1. If multiple connections exist, close each one before reopening. Use the sqlite3 module in Python to manage open connections.
Raw code # Example: close all connections before re-querying for conn in open_connections: conn.close() MongoDB Error messages: Raw code Error: couldn't execute operation: couldn't execute command. CommandFailed: Transaction 12 is being rolled back - lock was not available Fix steps:
  1. If a long-running operation holds the lock, wait for it to finish.
  2. If the operation is stuck, terminate it using its operation ID.
Raw code db.killOp(<op_id>)
  1. As a last resort, restart the MongoDB server if a bug or system issue is causing the lock.
Linux tooling Outside the database, use these Linux tools to identify signs of locking:
  • ps — lists running processes and shows which processes hold locks
  • lsof — lists all open files, including locked ones, and shows which process locks each file
  • strace — traces system calls and signals for a process, helping identify the root cause of a lock
  • fuser — shows which processes use a specific file or file system, including those holding locks

Notes/Information:

  • Design your schema and queries to minimize contention and reduce the need for locks.
  • Experiment with different isolation levels to prevent transactions from conflicting with each other.
  • Address locks promptly — persistent locks degrade database performance.

References/Internal Records:

Last modified on October 12, 2026