Lesson Learned #319: Lock request time out period exceeded using SSMS
Published Feb 03 2023 12:24 PM 11.8K Views

Today, we got a service request that our customer got the following error message: Lock request time out period exceeded. (.Net SqlClient Data Provider) using SQL Server Management Studio. Following I would like to share with you some details about this issue and how to find and fix it.

 

The first thing is to run a transaction without adding commit transaction, for example: 

 

 

 

 begin transaction
 CREATE TABLE IX7 (ID INT)

 

 

 

Second, modify the SET LOCK TIMEOUT in SQL Server Management Studio->Tools->Options->Query Execution->SQL Server->Advanced change the SET LOCK TIMEOUT from -1 to 10000 miliseconds. 

 

Jose_Manuel_Jurado_0-1675455105517.png

 

Third, go to the Object Explorer and try to expand tables and after around 10 seconds you are going to have the error message:

 

Jose_Manuel_Jurado_1-1675455200215.png

 

Why is happening this error?

 

First, let's investigate what is doing SQL Server Management Studio to fill up the list of the tables, using SQL Server Profiler of Azure Data Studio. 

 

Jose_Manuel_Jurado_2-1675455321149.png

 

  • Following the instrucctions, SSMS specified SET LOCK TIMEOUT 10000 and after it try to execute the query: SELECT SCHEMA_NAME(tbl.schema_id) AS [Schema], tbl.name AS [Name], tbl.object_id AS [ID] FROM sys.tables AS tbl ORDER BY [Schema] ASC,[Name] ASC
  • As sys.tables is now blocking by a previous CREATE TABLE instrucction we have to wait to release this blocking. Following our article here: Lesson Learned #22: How to identify blocking issues? - Microsoft Community Hub you could find the blocking issue:

Jose_Manuel_Jurado_3-1675455528820.png

  • Finally, after this 10 seconds we are going to receive this error message meanwhile we don't execute the commit transaction of the execution of CREATE TABLE. 

 

Sometimes, this issue could happen to performance issues.

 

Enjoy!

Version history
Last update:
‎Feb 03 2023 12:29 PM
Updated by: