Uploaded image for project: 'Log4net'
  1. Log4net
  2. LOG4NET-531

AdoNetAppender crashes application if BeginDbTransaction failed

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Invalid
    • Affects Version/s: 1.2.15
    • Fix Version/s: None
    • Component/s: Appenders
    • Labels:
      None
    • Environment:
      Windows Server 2012 R2 Datacenter, SQL Azure, Windows Service
    • Flags:
      Important

      Description

      AdoNetAppender crashed the process due to failed BeginDbTransaction:

      Framework Version: v4.0.30319
      Description: The process was terminated due to an unhandled exception.
      Exception Info: System.Data.SqlClient.SqlException
         at System.Data.SqlClient.SqlConnection.OnError(System.Data.SqlClient.SqlException, Boolean, System.Action`1<System.Action>)
         at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(System.Data.SqlClient.TdsParserStateObject, Boolean, Boolean)
         at System.Data.SqlClient.TdsParserStateObject.SNIWritePacket(System.Data.SqlClient.SNIHandle, System.Data.SqlClient.SNIPacket, UInt32 ByRef, Boolean, Boolean)
         at System.Data.SqlClient.TdsParserStateObject.WriteSni(Boolean)
         at System.Data.SqlClient.TdsParserStateObject.WritePacket(Byte, Boolean)
         at System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[], TransactionManagerRequestType, System.String, TransactionManagerIsolationLevel, Int32, System.Data.SqlClient.SqlInternalTransaction, System.Data.SqlClient.TdsParserStateObject, Boolean)
         at System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransactionYukon(TransactionRequest, System.String, System.Data.IsolationLevel, System.Data.SqlClient.SqlInternalTransaction, Boolean)
         at System.Data.SqlClient.SqlInternalConnection.BeginSqlTransaction(System.Data.IsolationLevel, System.String, Boolean)
         at System.Data.SqlClient.SqlConnection.BeginTransaction(System.Data.IsolationLevel, System.String)
         at System.Data.SqlClient.SqlConnection.BeginDbTransaction(System.Data.IsolationLevel)
         at log4net.Appender.AdoNetAppender.SendBuffer(log4net.Core.LoggingEvent[])
         at log4net.Appender.BufferingAppenderSkeleton.Append(log4net.Core.LoggingEvent)
         at <custom appender inherited from AdoNetAppender>
         at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
         at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
         at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
         at System.Threading.ThreadHelper.ThreadStart()
      

      I believe AdoNetAppender will crash in the same way, but we use it a bit customized.

      We have custom appender inherited from AdoNetAppender, which runs in separate thread and uses Queue to accumulate log events, so that database logging works asynchronously. It uses "base.Append(..)" to log events from queue. We use SQL Azure as database, which as cloud solution is not 100% available.

      In rare cases appender crashes the app domain on "BeginDbTransaction" line, as it is not covered with try / catch block.

        Attachments

          Activity

            People

            • Assignee:
              nachbarslumpi Dominik Psenner
              Reporter:
              lanorkin Vladimir Vedeneev
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: