UPDATE: I've since found that the solution of promoting to a distributed transaction brings up another issue. It appears that the distributed transaction sets up a call on another thread, and it is from this code that the nHibernate SessionImpl.AfterTransaction is called. This then causes an exception that a collection is modified whilst being iterated over. Still this is my best solution unless any one has a better idea??
On Apr 15, 2:48 pm, Iain <[email protected]> wrote: > Hi All, > > I am having a connection leak when we using the ambient transaction, > and the transaction is aborted. That is, I get the exception: > 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. > > I am guessing something is holding onto a reference to the connection, > or an internal part of the connection. As adding a watch to following > and debug breaking within the transaction also causes this issue. > ((System.Data.SqlClient.SqlInternalConnectionTds) > ((System.Data.SqlClient.SqlConnection) > (session.Connection))._innerConnection)._connectionPool.Count > > Is this a known issue or unsupported? Currently our workaround is to > promote the transaction to a distributed transaction which seems to > work ok, as per this > article:http://davybrion.com/blog/2010/03/msdtc-woes-with-nservicebus-and-nhi... > > Here is the unit test that re-produces the issue: > > [Test] > public void CanUseSystemTransactionsToAbort() > { > for (var i = 0; i < 200; i++) > { > using (ISession session = sessions.OpenSession()) > using (TransactionScope tx = new > TransactionScope(TransactionScopeOption.RequiresNew)) > { > W s = new W(); > session.Save(s); > session.Flush(); > } > } > > } > > Cheers, > > Iain -- 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.
