Transaction Problems

I have recently introduced the EventStore into my project and since they I occasionally get a lock up with the following error:

The server failed to resume the transaction. The transaction active in this session has been committed or aborted by another session.

The error is being thrown from NHibernate, however nothing else has changed other than introducing the event store.

Any ideas?

The full error is as follows:

2013-07-29 06:42:39,017 [Worker.21] WARN NHibernate.Util.ADOExceptionReporter [(null)] - System.Data.SqlClient.SqlException (0x80131904): The server failed to resume the transaction. Desc:4700000060.

The transaction active in this session has been committed or aborted by another session.

at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)

at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()

at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)

at System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer, TransactionManagerRequestType request, String transactionName, TransactionManagerIsolationLevel isoLevel, Int32 timeout, SqlInternalTransaction transaction, TdsParserStateObject stateObj, Boolean isDelegateControlRequest)

at System.Data.SqlClient.SqlInternalConnectionTds.PropagateTransactionCookie(Byte[] cookie)

at System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction tx)

at System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction transaction)

at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)

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)

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

at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean autoDiscoverTypes, Boolean callable, RowSelection selection, ISessionImplementor session)

at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)

at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)

at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)

This is highly unlikely to have anything to do with the EventStore.

Are you running projections through nhibernate as well? How are you
managing sessions?


We are using Ninject to host the session factory as a singleton. The session factory is injected into an NServiceBus handler where a new session is being created.

All the work is being handled in a transaction created by NServiceBus. It seems that something strange is happening to the underlying transaction before NHibernate has a chance to commit.

We are not making use of projections in this case. (Missed that)


I meant external projections eg into a sql database. My thought was
perhaps a session is getting shared with that code.

From the error my guess is a session is getting shared some place. One
difference that may be there is threading if you are for instance
using a CatchupSubscription that handles polling/subscribe for you, if
you were previously doing this single threaded (you get callbacks on a
different thread).



Thanks Greg. I will have to do some digging. Just thought I would out it out there.