Blocked session
A session waiting for a lock that another session holds.
When everything stalls at once, one session is often holding up the rest. How to find it and fix the cause, not the symptom.
Users report that the system has frozen: orders won’t save, reports spin, and the warehouse screens time out. The server isn’t busy. Instead, one session holds a lock that another needs, a third waits on the second, and soon dozens are queued. Restarting the application or killing sessions at random clears it for now, but without finding the head of the chain it will happen again.
A session waiting for a lock that another session holds.
The session holding that lock. It may itself be blocked by another.
The session at the top of the chain that isn’t waiting on anyone. This is the one to investigate.
What the blocked session is waiting for, and on which table, page, or row.
Step 1 of 4
Query sys.dm_exec_requests for sessions with a blocking_session_id, or use a monitoring tool.
Follow each blocking session up the chain until you reach one that isn’t blocked.
Its last statement, the program and user, how long its transaction has been open, and whether it’s waiting for the application.
Killing a session rolls back its work, which can take as long as it took to do. Know what you’re rolling back first.
The head blocker is often doing very little. For example: an application that opens a transaction, updates a row, then waits for a user to click OK before committing; a report running a long query at a strict isolation level; or a large batch update during the working day. Each has a different fix, from shorter transactions to row versioning to moving the batch to the evening.
Tell us when it happens and which applications use the database. A few lines are enough.