Vladimir Vedeneev created LOG4NET-531:
-----------------------------------------

             Summary: AdoNetAppender crashes application if BeginDbTransaction 
failed
                 Key: LOG4NET-531
                 URL: https://issues.apache.org/jira/browse/LOG4NET-531
             Project: Log4net
          Issue Type: Bug
          Components: Appenders
    Affects Versions: 1.2.15
         Environment: Windows Server 2012 R2 Datacenter, SQL Azure, Windows 
Service
            Reporter: Vladimir Vedeneev
            Priority: Critical


AdoNetAppender crashed the process due to failed BeginDbTransaction:

{noformat}
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()
{noformat}

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.





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to