You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by "Dominik Psenner (JIRA)" <ji...@apache.org> on 2016/11/09 12:48:59 UTC

[jira] [Closed] (LOG4NET-531) AdoNetAppender crashes application if BeginDbTransaction failed

     [ https://issues.apache.org/jira/browse/LOG4NET-531?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dominik Psenner closed LOG4NET-531.
-----------------------------------
    Resolution: Invalid
      Assignee: Dominik Psenner

Happy to help and closing as invalid.

Custom appender implementations have to handle exceptions if they are implemented in such a way that they can leak exceptions to the calling application. Feel free to join the dev list, it is the better place to discuss similar issues.

> 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
>            Assignee: Dominik Psenner
>            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)