DBAtlas · Database operations atlas

24 LockTimeout: Operation exceeded time limit waiting for a lock

MongoDB

What does it mean?

An operation exceeded its time limit while waiting for a required lock (e.g. at database/collection level) and was aborted. The lock could not be acquired in time.

Why does it happen?

A long-running operation or DDL command (e.g. conflicting administrative operations on a collection) holds the required lock; heavy concurrent writes; or an operation bounded by maxTimeMS expires while waiting for a lock. Seen with conflicting index/collection operations.

How to fix it

Find the operation holding the lock: inspect active and waiting operations with db.currentOp(); terminate it with db.killOp() if necessary. Move conflicting administrative commands (index builds, collMod, compact) to off-peak hours. Keep operations short and avoid unnecessarily long transactions. If needed, tune maxTimeMS to the workload.

Open in DBAtlas →

More from this engine