Never seen before, though I don't understand your comment about timeout. From what I gather it could, in general, be a bug somewhere causing Semaphore.Release() to be called more often than Semaphore.WaitOne() or similar. But from inside Microsoft's own sql client connection pool? Anything is possible, but it seems likely the true problem lies elsewhere.
This page suggest that if anything in your process somehow calls CloseHandle() with the wrong handle, it could mess up a completely unrelated Semaphore: http://social.msdn.microsoft.com/forums/en-US/adodotnetdataproviders/thread/b5b7a179-3737-4380-b6cf-843f3e71b317/ This is about similar problem for MySQL, which seemed to be caused by multiple old versions of the same dll being used (look towards the end). Beware if you have renamed some assembly but forgot to clean out the old one from the bin directory. http://bugs.mysql.com/bug.php?id=38476 Otherwise, could you have some problem in your code where some non-threadsafe object, such as ISession, is used by multiple threads? /Oskar 2010/10/5 scottl2001 <[email protected]>: > Hello all. > > I'm getting a problem with semaphore timeouts which, as I gather are > a > result of connections not being closed properly. I'm using Castle, > NHibernate, and MS SQL Server v 9.00.4035.00. > > > Anybody experience this previously? Details below. > > > Thanks in advance! > > > client code: > ------------------------------------------------------------- > LtExpression statusLessThanShipped = new LtExpression("Status", > Status.Shipped); > > > IList<Run> runs = RunProvider.CustomQuery(new Order[] > {Order.Asc("RunNumber") }, new ICriterion[] > { statusLessThanShipped }); > --------------------------------------------------------- > > > results in server error: > > > ------------------------------------------------------------------ > > > Server Error in '/' Application. > ________________________________________ > Adding the given count to the semaphore would cause it to exceed its > maximum count. > Description: An unhandled exception occurred during the execution of > the current web request. Please review the stack trace for more > information about the error and where it originated in the code. > > > Exception Details: System.Threading.SemaphoreFullException: Adding > the > given count to the semaphore would cause it to exceed its maximum > count. > > > Source Error: > An unhandled exception was generated during the execution of the > current web request. Information regarding the origin and location of > the exception can be identified using the exception stack trace > below. > > > Stack Trace: > > > [SemaphoreFullException: Adding the given count to the semaphore > would > cause it to exceed its maximum count.] > System.Threading.Semaphore.Release(Int32 releaseCount) +5291316 > > > System.Data.ProviderBase.DbConnectionPool.PutNewObject(DbConnectionInternal > obj) +57 > > > System.Data.ProviderBase.DbConnectionPool.DeactivateObject(DbConnectionInte > rnal > obj) +230 > > > System.Data.ProviderBase.DbConnectionPool.PutObject(DbConnectionInternal > obj, Object owningObject) +140 > > > System.Data.ProviderBase.DbConnectionInternal.CloseConnection(DbConnection > owningObject, DbConnectionFactory connectionFactory) +131 > > > System.Data.SqlClient.SqlInternalConnection.CloseConnection(DbConnection > owningObject, DbConnectionFactory connectionFactory) +38 > System.Data.SqlClient.SqlConnection.Close() +135 > > > NHibernate.Connection.ConnectionProvider.CloseConnection(IDbConnection > conn) +57 > > > [ADOException: Could not close System.Data.SqlClient.SqlConnection > connection] > > > NHibernate.Connection.ConnectionProvider.CloseConnection(IDbConnection > conn) +162 > > > NHibernate.Connection.DriverConnectionProvider.CloseConnection(IDbConnectio > n > conn) +13 > NHibernate.Impl.SessionFactoryImpl.CloseConnection(IDbConnection > conn) +44 > > > [ADOException: cannot close connection] > NHibernate.Impl.SessionFactoryImpl.CloseConnection(IDbConnection > conn) +96 > NHibernate.Impl.ConnectionManager.CloseConnection() +25 > NHibernate.Impl.ConnectionManager.AggressiveRelease() +59 > NHibernate.Impl.ConnectionManager.AfterStatement() +116 > NHibernate.Impl.BatcherImpl.CloseCommand(IDbCommand cmd) +141 > NHibernate.Impl.BatcherImpl.CloseCommand(IDbCommand st, > IDataReader > reader) +125 > NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, > QueryParameters queryParameters, Boolean returnProxies) +673 > > > NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImp > lementor > session, QueryParameters queryParameters, Boolean returnProxies) +67 > NHibernate.Loader.Loader.DoList(ISessionImplementor session, > QueryParameters queryParameters) +51 > NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor > session, QueryParameters queryParameters) +18 > NHibernate.Loader.Loader.List(ISessionImplementor session, > QueryParameters queryParameters, ISet querySpaces, IType[] > resultTypes) +81 > NHibernate.Impl.SessionImpl.Find(CriteriaImpl criteria, IList > results) +331 > NHibernate.Impl.SessionImpl.Find(CriteriaImpl criteria) +39 > NHibernate.Impl.CriteriaImpl.List() +15 > Castle.ActiveRecord.ActiveRecordBase.FindAll(Type targetType, > Order[] orders, ICriterion[] criteria) +125 > > > [ActiveRecordException: Could not perform FindAll for Run] > Castle.ActiveRecord.ActiveRecordBase.FindAll(Type targetType, > Order[] orders, ICriterion[] criteria) +266 > Castle.ActiveRecord.ActiveRecordBase`1.FindAll(Order[] orders, > ICriterion[] criteria) +83 > RunApplications.Data.Providers.BaseProvider`1.CustomQuery(Order[] > order, ICriterion[] criteria) in C:\development2\In Progress > \RunApplications\RunApplications.Data\Providers\BaseProvider.cs:139 > RunApplications.Data.Providers.RunProvider.CustomQuery(Order[] > order, ICriterion[] criteria) in C:\development2\In Progress > \RunApplications\RunApplications.Data\Providers\RunProvider.cs:288 > BusinessCenter.Web.Home.Page_Load(Object sender, EventArgs e) in > C: > \development2\In Progress\BSPBusinessCenter\BusinessCenter.Web > \BusinessCenter.Web\Home.aspx.cs:23 > System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, > Object o, Object t, EventArgs e) +14 > System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object > sender, EventArgs e) +35 > System.Web.UI.Control.OnLoad(EventArgs e) +99 > System.Web.UI.Control.LoadRecursive() +50 > System.Web.UI.Page.ProcessRequestMain(Boolean > includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) > +627 > > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
