Today it was all hands on deck, as one our production services started to scream error messages.
After checking the log telemetry and running some tests, we could pinpoint the issue to a database timeout. Read operations were executed succesfully but all right operations timed out.
This made us think that a deadlock was causing the issue. But how do you know for sure?
Read on how you can check this…
- Open SQL Server Management Studio
- Connect to the suspicious database
- Right click on the database, select Reports and choose the Resource Locking Statistics by Objects report
I didn’t create a screenshot at the moment of the issue(too busy fixing it), but the report showed multiple sessions to the same table where one session was Granted a lock while the other where waiting.
To free the lock, you could kill the session using the session id that is causing the lock:
KILL <sessionid>