Unhandled exception in System.Transactions stops Windows service during network instability

We start the service based on NServiceBus using the host process NServiceBus.Host.exe.

Twice in production over the past few months, the Windows service unexpectedly stopped working, leaving the following event in the application event log:

Application: NServiceBus.Host.exe Framework version: v4.0.30319 Description: The process was interrupted due to an unhandled exception. Exception Information: System.InvalidOperationException stack: in System.Transactions.TransactionState.ChangeStatePromotedPhase0 (System.Transactions.InternalTransaction) in System.Transactions.Phase0VolatileDemultiplexer.InternalPrepare (System.Transactions.VolatilePermablePoolable.ultablePoolable.ultablePoolable.ultablePoolable.ultablePoolable.ultolipemableipultipultipultipultipultipultipultipultipultipultipulipableipultipultipableipultipultipulipableipultipultipultipultipableipultipultipableipultipableipultipultipulipableipultipultipableipultipableipultipultableultultipultipultipableipultipultipultipultableultultipultipultipultableultultipulable () Transactions.Oletx.OletxVolatileEnlistment.Prepare (System.Transactions.Oletx.OletxVolatileEnlistmentContainer) in System.Transactions.Oletx.OletxPhase0VolatileEnlistmentContainer.Phase0Request.lex.translation.letxlebtlet.translation.letxlebtlet.translation.translation.letxt01.translation.translate.translation.letxt01.translation.translate.translate.translate.translate.translate.letx.translate.translate.letx.translate.btransport.translate.lobtan.translate.leight ._ThreadPoolWaitOrTimerCallback.PerformWaitOrTimerCallback (System.Object, Boolean)

(, , log4net)

, ?

log4net.

:

  • Windows Server 2008 R2
  • .NET Framework 4.5.2
  • NServiceBus 4.7.5
  • NHibernate 3.3.3.4001 ( , -)
  • SQL Server 2012
+4
1

, , , , NHibernate TransactionCompleted. - .

AdoNetWithDistributedTransactionFactory TransactionCompleted. ThreadPool.QueueUserWorkItem. - (, - ), AppDomain. UnhandledExceptions AppDomain , , NServiceBus.Host.

UnhandledException AppDomain, ,

AppDomain.CurrentDomain.UnhandledException += OnUnhandledException

private static void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
    LogManager.GetLogger(typeof(AppDomain)).Fatal("Unhandled exception", e.ExceptionObject as Exception);
}

.

, NHibernate

+1

Source: https://habr.com/ru/post/1607260/


All Articles