Note that there are some explanatory texts on larger screens.

plurals
  1. POException causing windows service to crash on ending distributed transaction with NHibernate
    primarykey
    data
    text
    <p>I have a windows service written in the .NET 4.0 framework that uses NHibernate enlisting in a distributed transaction talking to an Oracle database. Within our test environment the service encountered an error with the database which seems to have caused a problem with NHibernate closing the ADO.NET connection.</p> <p>The entire call against NHibernate, from opening the session to disposing of it, is wrapped within a try/catch block that catches System.Exception but the error is not caught within that block.</p> <p>I've included the stack trace from the windows event log below for reference.</p> <p>I believe that the exception is being thrown in another thread (which the stack trace seems to refer to) which then propogates up and causes the windows service to crash.</p> <p>My questions are:<br> 1. If it is another thread, where does it come from (what starts it)?<br> 2. Is there anything I can add to my code to make sure this exception does not escape and bring down the windows service?</p> <hr> <p>Application: X<br> Framework Version: v4.0.30319<br> Description: The process was terminated due to an unhandled exception.<br> Exception Info: NHibernate.ADOException<br> Stack:<br> at NHibernate.Connection.ConnectionProvider.CloseConnection(System.Data.IDbConnection)<br> at NHibernate.Connection.DriverConnectionProvider.CloseConnection(System.Data.IDbConnection)<br> at NHibernate.AdoNet.ConnectionManager.CloseConnection()<br> at NHibernate.AdoNet.ConnectionManager.AfterTransaction()<br> at NHibernate.Impl.SessionImpl.AfterTransactionCompletion(Boolean, NHibernate.ITransaction)<br> at NHibernate.Transaction.AdoNetWithDistributedTransactionFactory+&lt;>c_<em>DisplayClass1.b</em>_0(System.Object, System.Transactions.TransactionEventArgs)<br> at System.Transactions.TransactionCompletedEventHandler.Invoke(System.Object, System.Transactions.TransactionEventArgs)<br> at System.Transactions.TransactionStatePromotedAborted.EnterState(System.Transactions.InternalTransaction)<br> at System.Transactions.InternalTransaction.DistributedTransactionOutcome(System.Transactions.InternalTransaction, System.Transactions.TransactionStatus)<br> at System.Transactions.Oletx.RealOletxTransaction.FireOutcome(System.Transactions.TransactionStatus)<br> at System.Transactions.Oletx.OutcomeEnlistment.InvokeOutcomeFunction(System.Transactions.TransactionStatus)<br> at System.Transactions.Oletx.OletxTransactionManager.ShimNotificationCallback(System.Object, Boolean)<br> at System.Threading._ThreadPoolWaitOrTimerCallback.PerformWaitOrTimerCallback(System.Object, Boolean) </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload