Blog Post

Azure Database Support Blog
1 MIN READ

Lesson Learned #206: Hands-On-Labs: The timeout period elapsed prior to obtaining a connection

Jose_Manuel_Jurado's avatar
Jun 26, 2022

We used to have cases where our customer faced the following error message: "Timeout expired.  The timeout period elapsed prior to obtaining a connection from the pool.  This may have occurred because all pooled connections were in use and max pool size was reached" in this video we are going to give some insights about it.

 

This issue happened when we reached the maximum number of connections opened of our connection pooling. In this situation, we need to identify why?, for example:

  • Your application increases the number of concurrent connection opened reaching the maximum of connection pooling available. 
  • Your application increases the number of operations that needs to have a connection.
  • Your application is not closing the connection due to any issue or unhandle, leaving the connection opened. 

 

What is the benefit of connection pooling?

  • Cache the connection reducing the connection time.
  • Enable by default.

Why this issue happens?

  • Application reached the maximum number of open connection of the pool. By default, is 100.
  • Connection Pool is per application and connectionstring.
  • ADO.NET – System.Data.SqlClient

How to find all connections opened and how connection pooling is working?

  • Select * from sys.dm_exec_connections and sys.dm_exec_sessions
  • Performance Counters .NET Data Provider for SqlServer

How to fix the issue?

  • Increase the Max connection Pooling (MaxPool)
  • Review if your application is leaving the connection open.

 

 

Enjoy!

Updated Jun 28, 2022
Version 4.0
No CommentsBe the first to comment