apache / logging-log4net

Apache Log4net is a versatile, feature-rich, efficient logging API and backend for .NET
https://logging.apache.org/log4net
Apache License 2.0
849 stars 324 forks source link

Possible System.IndexOutOfRangeException in AppenderSkeleton.Finalize() #134

Closed NicoCV closed 5 months ago

NicoCV commented 5 months ago

We're using Log4Net (2.0.15.0-.NET 4.5) in WCF services hosted in IIS. On our production environments from time to times we're experiencing crash of the application pool with following error:

Exception: System.IndexOutOfRangeException

Message: Index was outside the bounds of the array.

StackTrace: at System.Collections.ArrayList.Add(Object value) at log4net.Util.LogReceivedEventHandler.Invoke(Object source, LogReceivedEventArgs e) at log4net.Util.LogLog.OnLogReceived(Type source, String prefix, String message, Exception exception) at log4net.Util.LogLog.Debug(Type source, String message) at log4net.Appender.AppenderSkeleton.Finalize()

So it seems the LogLog.Debug statement in the finalize method can fail in some circumstances...

FreeAndNil commented 5 months ago

@NicoCV can you test the code change from #135?

NicoCV commented 5 months ago

@FreeAndNil : First of all thanks for the really quick reaction and action! Unfortunatly it won't be possible for us to really test this. We've only seen this on production, and have not been able to simulate this on a non-production environment.

And we don't want to put an 'unofficial' version of the library on production.

FreeAndNil commented 5 months ago

@NicoCV I understand. The official release for this issue will be 3.0.0 expected in 2 months.