0X0000012C

Oplock Error 0X0000012C: Fix the Denied Oplock Request

Windows Errors Intermediate 👁 11 views 📅 May 26, 2026

ERROR_OPLOCK_NOT_GRANTED means Windows denied an oplock request, often due to file locks or network sharing. Here's the fix and why it works.

Why You're Seeing 0X0000012C

I know this error is infuriating — you're trying to serve files or run a database, and Windows slaps you with ERROR_OPLOCK_NOT_GRANTED. It usually hits when an app requests an opportunistic lock (oplock) on a file, but something else won't let go. Think SQL Server, file servers, or even a network share with a stuck lock.

The core problem: the oplock request got denied because the file's already locked or the SMB protocol isn't cooperating. Let's fix it.

The Fix: Registry Tweaks and SMB Tuning

Skip the generic advice — the real fix involves adjusting how Windows handles oplocks. Here's what worked for me after years of help desk calls.

Step 1: Disable Oplock for the Affected Folder

If it's a specific folder (like a database data directory), stop Windows from granting oplocks there. Open PowerShell as admin and run:

fsutil behavior set disableopportunisticlock 1

This disables oplocks system-wide. Yes, it's blunt. It stops the error dead, but it can slow file performance in high-latency scenarios. Test it first. If that fixes the error, you've identified the culprit — then refine it.

To re-enable: fsutil behavior set disableopportunisticlock 0

Step 2: Tweak SMB Oplock Values in Registry

For a finer fix, target the SMB client. Open Regedit and go to:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters

Create a new DWORD (32-bit) called EnableOplocks. Set it to 0 to disable oplocks for SMB. This is the route for network share errors.

If you're on Windows Server 2019/2022 or Windows 11 Pro, also check:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters

Create EnableOplocks (DWORD, 0). Reboot.

Step 3: Kill Stale File Locks

Sometimes the error is because a process holds a lock. Use handle.exe from Sysinternals (download it) to find the offender. Run:

handle.exe -a <path-to-file>

Look for something like svchost.exe or a third-party backup tool. Kill the process with taskkill /PID <pid> /F. This fixed it for a client whose antivirus was locking database files.

Why This Works

Oplocks let a client cache file data locally, reducing network chatter. When another client requests write access, the oplock is broken. But if the lock isn't released cleanly — say from a crash or an app that doesn't follow SMB rules — the next request gets 0X0000012C.

Disabling oplocks forces every read/write to go through the server. It's slower but reliable. The registry tweak tells SMB to never ask for an oplock, bypassing the denial entirely. The handle approach solves the immediate lock holder, which is often a rogue process.

Less Common Variations

Oplock Denied on Database Files

SQL Server and Exchange rely on oplocks for performance. Disabling them globally can tank your DB throughput. Instead, move database files to a volume with DisableOplocks = 0 (default). Use fsutil per-volume:

fsutil behavior set disableopportunisticlock 1 C:

But leave other volumes at 0. This limits the performance hit.

Oplock Error on NAS or SMB Share

If you're hitting this on a Synology or QNAP NAS, check the SMB version. Windows 11 with SMB 3.1.1 can be finicky with older NAS firmware. Downgrade to SMB 2.1 via Group Policy (Computer Configuration -> Administrative Templates -> Network -> Lanman Workstation). Not ideal, but it works.

Oplock Granted but Then Denied

Some apps log ERROR_OPLOCK_NOT_GRANTED even when the first request succeeded. This is usually a race condition. Increase the OplockBreakWait registry key (in milliseconds) under LanmanServer\Parameters. Default is 35. Try 100 or 200. This gives your app time to release the lock.

Prevention: Keep Oplocks Working Smoothly

You don't want to disable oplocks permanently — they're there for a reason. Here's how to avoid the error going forward:

  • Update your network drivers. Outdated Realtek or Intel NIC drivers on Windows 10/11 cause SMB issues more often than you'd think. Check the vendor site, not Windows Update.
  • Use SMB 3.1.1 where possible. Its lease model is better than old-style oplocks. Enable it on both ends.
  • Monitor file locks. Use oplockcheck.exe (Sysinternals) to see what's holding locks on shared paths.
  • Set proper file share permissions. Too many concurrent connections can exhaust the oplock pool. Limit max connections in the share properties.
  • Restart the Server service. Once a week in maintenance windows: net stop server && net start server clears stale locks.

That's it — you've got the fix, the why, and the edge cases. This error is stubborn, but these steps hit it from every angle. Good luck.

Was this solution helpful?