ENOLCK
Linux / POSIXERRORNotableFile SystemHIGH confidence

No Locks Available

Production Risk

Rare — usually indicates a lock leak in application code.

What this means

ENOLCK (errno 37) is returned when the system's lock table is full and no more POSIX advisory file locks can be allocated. The kernel maintains a finite pool of lock structures.

Why it happens
  1. 1System-wide limit on file locks (controlled by /proc/sys/fs/file-max or kernel config) exhausted
  2. 2A process is holding a very large number of POSIX locks without releasing them
  3. 3NFS server returning an error that is translated to ENOLCK on the client
How to reproduce

Lock table exhaustion on a busy database or file server.

trigger — this will error
trigger — this will error
# Check current lock usage:
cat /proc/locks | wc -l

expected output

fcntl: No locks available (ENOLCK)

Fix

Increase the system lock limit

WHEN When the lock table is genuinely exhausted

Increase the system lock limit
# Increase max locks (default is often 2048):
sysctl -w fs.leases-enable=1
# Check current locks:
cat /proc/locks

Why this works

The kernel lock table size is fixed at boot. Identify which processes hold many locks via /proc/locks and fix lock leaks in application code.

Sources
Official documentation ↗

Linux Programmer Manual fcntl(2)

/proc/locks

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All Linux / POSIX errors