How can I change the Max pool size with the SharePoint Server Subscription Edition, as there is error prompt all pooled connections were in use and max pool size was reached

Tiffany Kwan 0 Reputation points
2025-10-08T03:26:29.4733333+00:00

Q1. My SharePoint server prompt error "System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: 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."

Microsoft 365 and Office | SharePoint | Development
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Nghia-P 6,595 Reputation points Microsoft External Staff Moderator
    2025-10-08T04:43:18.9033333+00:00

    Hi Tiffany Kwan,

    Welcome to Microsoft Q&A Forum!

    Have a good day and I hope you're doing well!

    During our review of the error you encountered on SharePoint Server ("System.AggregateException: One or more errors occurred… all pooled connections were in use and max pool size was reached"), we have identified this as an issue related to the Connection Pooling mechanism in .NET/SQL Server. 

    Based on our analysis and references from similar cases, this error typically occurs when: 

    • The application or custom code in SharePoint opens a connection to the database but does not close it properly (connection leak). 
    • Too many connections are opened simultaneously, causing the connection pool to reach the Max Pool Size limit (default is usually 100). 
    • Some queries or operations to SQL Server take a long time to process, preventing connections from being released promptly. 

    When all connections are in use, new requests cannot obtain a connection from the pool. The system will wait until the timeout period expires and return the error as seen. 
    1. Review code and database connections: 

    • Ensure all connections are closed or disposed of properly after use. 
    • If possible, apply the using syntax in .NET to automatically release resources: 
    • Avoid returning SqlDataReader or SqlConnection without closing them from the calling side. 
    using (SqlConnection conn = new SqlConnection(connStr)) 
    { 
        conn.Open(); 
        using (SqlCommand cmd = new SqlCommand(query, conn)) 
        using (SqlDataReader reader = cmd.ExecuteReader()) 
        { 
            while (reader.Read()) 
            { 
                // process data 
            } 
        } 
    } 
    

    2. Increase the Max Pool Size value if it fits the actual load: 

    • You can add to the connection string:
    Max Pool Size=200; 
    
    • However, this is only a temporary solution. The sustainable approach is to ensure connections are closed properly. 

    3. Monitor SQL Server: 

    • Use sys.dm_exec_connections or sys.dm_exec_sessions to check the number of open connections. 
    • Analyze queries that are running long or are blocked. 

    Additional References 

    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link 
    I hope the information I provided will be partially useful. If I misunderstand or anything is unclear, or you have any concern, question, don't hesitate to let me know.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".    

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread. 

    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.