About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.
An application reports "Lock request time out period exceeded." and the statement that was running is cancelled. Nothing is corrupt and nothing has crashed. A statement asked for a lock, another transaction was already holding a conflicting lock, and the wait ran past the limit the session had set.
Below is how to tell what the limit is, how to find the transaction in the way, and what Microsoft's page says to do about it.
What the error means
Microsoft lists error 1222 as event ID 1222, symbolic name LK_TIMEOUT, with the message text "Lock request time out period exceeded." Its explanation reads: "Another transaction held a lock on a required resource longer than this query could wait for it."
The wait limit comes from SET LOCK_TIMEOUT. Microsoft's page for that setting says the value is the number of milliseconds before SQL Server returns a locking error, and that "A value of -1 (default) indicates no time-out period (that is, wait forever)." A value of 0 means "to not wait at all and return a message as soon as a lock is encountered." Because the default is to wait forever, an error 1222 implies that something set a time-out on that connection: the application, a framework, or a stored procedure. That follows from the two pages taken together; neither page says where the setting came from.
The setting is per connection: "At the beginning of a connection, this setting has a value of -1. After it is changed, the new setting stays in effect for the remainder of the connection." And it does not cover everything: "CREATE DATABASE, ALTER DATABASE, and DROP DATABASE statements do not honor the SET LOCK_TIMEOUT setting."
The error therefore has two ingredients, and both must be present. Something holds a lock, and the waiting statement is on a clock. Remove either one and the error disappears, which is why Microsoft's page offers both a way to end the block and a way to change the clock.
Likely causes
Microsoft names one cause and two ways out of it. The practical causes behind it are the ordinary ones for any block:
| What is happening | How it shows |
|---|---|
| A long-running transaction still holds locks | A session in sys.dm_os_waiting_tasks shows a blocking_session_id for the waiting task |
| A transaction was left open by an application | The blocker has locks in sys.dm_tran_locks but is doing no work |
| The time-out is set very low for this connection | @@LOCK_TIMEOUT returns a small number of milliseconds (or 0) |
| Both together | Short time-out, brief but real block |
Prove the cause before changing anything
All of these read only. Run them in the session that gets the error where you can, and a separate session for the rest.
- See the time-out in force for your own session. Microsoft's
@@LOCK_TIMEOUTpage says it "returns the current lock timeout setting in milliseconds for the current session" and returns -1 ifSET LOCK_TIMEOUThas not been run in the session:
SELECT @@LOCK_TIMEOUT AS [Lock Timeout];
That tells you the setting for the session you ran it in. It does not tell you what the application's own connection uses, so ask the application owner or read the connection code.
- Find the blocker. The error page says to "Locate the transaction that is holding the lock on the required resource, if possible" and to use
sys.dm_os_waiting_tasksandsys.dm_tran_locks. Insys.dm_os_waiting_tasks, Microsoft'sblocking_session_idcolumn holds the "ID of the session blocking the request"; a NULL means the request isn't blocked. The page also lists special values: -2 for an orphaned distributed transaction, -3 for a deferred recovery transaction, -4 for a latch owner that could not be determined.
SELECT session_id, wait_duration_ms, wait_type, blocking_session_id, resource_description
FROM sys.dm_os_waiting_tasks
WHERE blocking_session_id IS NOT NULL;
- Look at the locks.
sys.dm_tran_lockshas one row per lock request. Itsrequest_session_idcolumn is the session that owns the request, and itsrequest_statuscolumn shows whether the request is granted or waiting.
SELECT request_session_id, resource_type, resource_database_id, request_mode, request_status
FROM sys.dm_tran_locks;
- Identify the blocker's connection. Microsoft's KILL page gives a query for finding the session you are after:
SELECT conn.session_id, host_name, program_name,
nt_domain, login_name, connect_time, last_request_end_time
FROM sys.dm_exec_sessions AS sess
JOIN sys.dm_exec_connections AS conn
ON sess.session_id = conn.session_id;
Because error 1222 has already fired, the blocker may have finished by the time you look. In that case the DMVs are empty, and you need to catch the block while it happens, or accept that the time-out was too short for a normal brief wait.
Example (illustrative): at contoso.com.au a nightly stock import reports 1222 against StockDB. At 02:10, sys.dm_os_waiting_tasks shows session 61 waiting 4,200 ms with blocking_session_id 54. The session query shows 54 is a reporting tool's connection, last_request_end_time 45 minutes ago. The reporting tool left a transaction open.
Fix
Microsoft's user action has four steps: find the lock holder, end its transaction if appropriate, run the query again, and "If this error occurs frequently change the lock time-out period or modify the offending transactions so that they hold the lock for less time."
End the blocking transaction
Microsoft's KILL page says the statement ends a user process and that "KILL is commonly used to end a process that is blocking other important processes with locks." It also warns to use KILL carefully, that you can't kill your own process, and that if the session has much work to undo, the statement "can take some time to complete" because it rolls back a long transaction.
A KILL cannot be taken back: the transaction is rolled back and its work is lost. For that reason no KILL command is printed here. If you decide to end a blocker, make sure of three things first: the session ID in blocking_session_id is the one you checked in the session query above; its owner or application owner agrees; and nothing important is part of its transaction. Microsoft's page notes that KILL <session ID> WITH STATUSONLY reports rollback progress without ending anything.
Change the lock time-out
If the blocks are brief and expected, the time-out may simply be too short. The time-out belongs to the code that issues it, so the change is in the application or procedure that runs SET LOCK_TIMEOUT.
Save first. Note the value now in use (in the application code, or by running this in the same session) before you change it.
SELECT @@LOCK_TIMEOUT AS [Lock Timeout];
Risk: The next statement changes how long every following statement on that one connection waits for locks. A longer time-out means a blocked statement waits longer before it fails, so users may see a slow screen instead of an error. A value of -1 waits forever. It does not apply to other connections or survive the connection.
SET LOCK_TIMEOUT 5000;
The 5000 here is an example in milliseconds, not a recommended value. Microsoft's own example is 1800. Run in an administrator's own session, the statement changes only that session; the application's connection changes only when its own code issues the statement.
To undo it: run SET LOCK_TIMEOUT -1; to return to the default of waiting without limit, or run it with the earlier value you noted.
Choose what the statement should do when it meets a lock
A lock time-out is a design decision as much as a fault: the application has said how long it is willing to wait. Microsoft's SET LOCK_TIMEOUT page lists two related facts a developer needs. A value of 0 "means to not wait at all", so any lock held by another transaction produces error 1222 immediately. And "The READPAST locking hint provides an alternative to this SET option", which is a way to skip locked rows instead of waiting for them or failing. The page does not describe READPAST further, so whether skipping rows is acceptable depends entirely on what the statement is for. For a job that must read every row, an error is the safer behaviour than a silent skip, and the fix is a shorter transaction on the other side. This is a check of the application's code by its owner, not a server setting.
Shorten the transaction
The page's other remedy is to modify the offending transactions so that they "hold the lock for less time". That is a change to the application or procedure that owns the transaction, and its owner should make it.
Confirm the fix
- Re-run the failed job and watch that error 1222 no longer appears.
- Run the waiting-tasks query during the busiest part of the job and confirm no task waits on a blocker for long.
- If you changed the time-out, run
SELECT @@LOCK_TIMEOUTin the same kind of session to confirm the value.
What to watch afterwards
- Whether the same session ID or the same application is the blocker every time. Microsoft says to modify the offending transactions if the error keeps recurring.
- Open transactions left by tools that connect and idle.
- Whether errors move from 1222 to long waits after a time-out increase. A longer time-out hides the symptom without removing the block.
Read next
Related articles you may want next.
- TroubleshootingSQL Requests Are Waiting: Find the Head Blocker Before Ending SessionsBuild a time-correlated blocking chain and identify the transaction owner before deciding on intervention.Read article
- TroubleshootingSQL Deadlock Error 1205: Read the Graph and Fix the Access PatternUse a deadlock graph to identify competing resources and select a transaction or query change with a bounded retry contract.Read article
- PerformanceSQL Queries Wait for Memory: Diagnose RESOURCE_SEMAPHOREDistinguish excessive grants, underestimated grants and concurrency pressure before changing memory settings.Read article
Risks and limits
These queries and statements have not been run in a lab. Microsoft's error 1222 page is short: it describes one cause and four actions and gives no version range, and it does not tell you how to catch a block that has already ended. The KILL step is left to the reader's judgement because it cannot be undone.
Sources
- MSSQLSERVER_1222 — Microsoft Learn, page dated 2025-11-18, accessed 1 December 2026
- SET LOCK_TIMEOUT (Transact-SQL) — Microsoft Learn, page dated 2026-09-21, accessed 1 December 2026
- @@LOCK_TIMEOUT (Transact-SQL) — Microsoft Learn, page dated 2026-02-10, accessed 1 December 2026
- sys.dm_os_waiting_tasks (Transact-SQL) — Microsoft Learn, page dated 2026-09-21, accessed 1 December 2026
- sys.dm_tran_locks (Transact-SQL) — Microsoft Learn, page dated 2026-09-21, accessed 1 December 2026
- KILL (Transact-SQL) — Microsoft Learn, page dated 2026-09-21, accessed 1 December 2026
This article was originally published on .