Help. Max connection pool size was reached?

Topics: Troubleshooting
Jan 21, 2012 at 7:53 PM
Hello, a new production website is crashing on a timeout every two hours on low activity - never an issue in stage environment (of course).
I would like to quickly release all connections on this error, but mostly I would like to avoid it altoghether.
The database is on a remote sql server 2005 machine and we are using advanced menu and virtual media (and a couple more) and we have our own modules but none of them are accessing data.
Any help would be appreciated.
2012-01-21 09:12:09,033 [91] Orchard.ContentManagement.Drivers.Coordinators.ContentPartDriverCoordinator - ArgumentNullException thrown from IContentPartDriver by Szmyd.Orchard.Modules.Menu.Drivers.BreadcrumbsPartDriver
System.ArgumentNullException: Value cannot be null.
Parameter name: source
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Szmyd.Orchard.Modules.Menu.Drivers.BreadcrumbsPartDriver.Display(BreadcrumbsPart part, String displayType, Object shapeHelper)
at Orchard.ContentManagement.Drivers.ContentPartDriver`1.Orchard.ContentManagement.Drivers.IContentPartDriver.BuildDisplay(BuildDisplayContext context) in d:\Builds\OrchardFull\src\Orchard\ContentManagement\Drivers\ContentPartDriver.cs:line 20
at Orchard.ContentManagement.Drivers.Coordinators.ContentPartDriverCoordinator.<>c__DisplayClassa.<BuildDisplay>b__9(IContentPartDriver driver) in d:\Builds\OrchardFull\src\Orchard\ContentManagement\Drivers\Coordinators\ContentPartDriverCoordinator.cs:line 45
at Orchard.InvokeExtensions.Invoke[TEvents](IEnumerable`1 events, Action`1 dispatch, ILogger logger) in d:\Builds\OrchardFull\src\Orchard\InvokeExtensions.cs:line 19
 
++++++++++++++++++++++CRASH CRASH CRASH+++++++++++++++++++++++++++++


2012-01-21 09:12:27,129 [91] NHibernate.Util.ADOExceptionReporter - While preparing SELECT contentite0_.Id as Id407_0_, contentite0_.Data as Data407_0_, contentite0_.ContentType_id as ContentT3_407_0_ FROM Orchard_Framework_ContentItemRecord contentite0_ WHERE contentite0_.Id=@p0 an error occurred
2012-01-21 09:12:27,129 [91] NHibernate.Util.ADOExceptionReporter - 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.

+ System
   
- Provider
      [ Name] ASP.NET 4.0.30319.0
   
- EventID 1309
      [ Qualifiers] 32768
   
  Level 3
   
  Task 3
   
  Keywords 0x80000000000000
   
- TimeCreated
      [ SystemTime] 2012-01-21T14:12:28.000Z
   
  EventRecordID 15462
   
  Channel Application
   
  Computer nn1823.van.ca.siteprotect.com
   
  Security
- EventData
      3005
      An unhandled exception has occurred.
      1/21/2012 9:12:28 AM
      1/21/2012 2:12:28 PM
      65f1856b72b34d70aa475bea1dbe013a
      6521
      7
      0
      /LM/W3SVC/7/ROOT-6-129715641752818927
      Full
      /
      D:\ftpsites\LocalUser\cmaorchard\CMA live\
      NN1823
       
      364
      w3wp.exe
      NT AUTHORITY\NETWORK SERVICE
      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. at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open() at NHibernate.Connection.DriverConnectionProvider.GetConnection() at NHibernate.AdoNet.ConnectionManager.GetConnection() at NHibernate.AdoNet.AbstractBatcher.Prepare(IDbCommand cmd)
      http://www.the-cma.org/about/blog/consumerism-done-differently-part-1?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed: CanadianMarketingBlog (Canadian Marketing Blog)
      /about/blog/consumerism-done-differently-part-1
    89.151.99.94
     
    False
     
    NT AUTHORITY\NETWORK SERVICE
    84
    NT AUTHORITY\NETWORK SERVICE
    False
    at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open() at NHibernate.Connection.DriverConnectionProvider.GetConnection() at NHibernate.AdoNet.ConnectionManager.GetConnection() at NHibernate.AdoNet.AbstractBatcher.Prepare(IDbCommand cmd)

Event code: 3005

Event message: An unhandled exception has occurred.

Event time: 1/21/2012 9:12:28 AM

Event time (UTC): 1/21/2012 2:12:28 PM

Event ID: 65f1856b72b34d70aa475bea1dbe013a

Event sequence: 6521

Event occurrence: 7

Event detail code: 0

 

Application information:

Application domain: /LM/W3SVC/7/ROOT-6-129715641752818927

Trust level: Full

Application Virtual Path: /

Application Path: D:\ftpsites\LocalUser\cmaorchard\CMA live\

Machine name: NN1823

 

Process information:

Process ID: 364

Process name: w3wp.exe

Account name: NT AUTHORITY\NETWORK SERVICE

 

Exception information:

Exception type: InvalidOperationException

Exception 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.

at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)

at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)

at System.Data.SqlClient.SqlConnection.Open()

at NHibernate.Connection.DriverConnectionProvider.GetConnection()

at NHibernate.AdoNet.ConnectionManager.GetConnection()

at NHibernate.AdoNet.AbstractBatcher.Prepare(IDbCommand cmd)

 

 

Request information:

Request URL: http://www.the-cma.org/about/blog/consumerism-done-differently-part-1?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed: CanadianMarketingBlog (Canadian Marketing Blog)

Request path: /about/blog/consumerism-done-differently-part-1

User host address: 89.151.99.94

User:

Is authenticated: False

Authentication Type:

Thread account name: NT AUTHORITY\NETWORK SERVICE

 

Thread information:

Thread ID: 84

Thread account name: NT AUTHORITY\NETWORK SERVICE

Is impersonating: False

Stack trace: at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)

at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)

at System.Data.SqlClient.SqlConnection.Open()

at NHibernate.Connection.DriverConnectionProvider.GetConnection()

at NHibernate.AdoNet.ConnectionManager.GetConnection()

at NHibernate.AdoNet.AbstractBatcher.Prepare(IDbCommand cmd)

 

 

Custom event details: 

Jan 23, 2012 at 4:30 PM

Update: I found that MsSql2008 is hardcoded in Orchard.Source.1.3.9\src\Orchard\Data\Providers\SqlServerDataServicesProvider.cs

 

  public override IPersistenceConfigurer GetPersistenceConfigurer(bool createDatabase) {
            var persistence = MsSqlConfiguration.MsSql2008;
            if (string.IsNullOrEmpty(_connectionString)) {
                throw new ArgumentException("The connection string is empty");
            }
            persistence = persistence.ConnectionString(_connectionString);
            return persistence;
        }

Could this be a clue?

Thank you.

 

  public override IPersistenceConfigurer GetPersistenceConfigurer(bool createDatabase) {
            var persistence = MsSqlConfiguration.MsSql2008;
            if (string.IsNullOrEmpty(_connectionString)) {
                throw new ArgumentException("The connection string is empty");
            }
            persistence = persistence.ConnectionString(_connectionString);
            return persistence;
        }
Jan 23, 2012 at 4:51 PM

I believe I have my answer. There is a sql 2005 work item regarding connection leaks and exceptions:

http://orchard.codeplex.com/workitem/18154

Thank you.