[
https://issues.apache.org/jira/browse/LOG4NET-582?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16278160#comment-16278160
]
Durgesh Khandal commented on LOG4NET-582:
-----------------------------------------
Hi [~bodewig],
Thank you for looking into this and responding back. Please find below points
which might help:
1. Regarding Internal logging, it is currently disabled only as I don't see a
'log4net.Internal.Debug' entry in our application config files.
2. I verified again the log4net DLL version in our application and it is indeed
1.2.15. I then decompiled the DLL and able to match the stack trace to the code
of 1.2.15. If you see, there's a call of
{code:java}
InternalConfigure(repository)
{code}
in
{code:java}
XmlConfigurator.Configure(ILoggerRepository repository)
{code}
which further calls
{code:java}
LogLog.Error
{code}
https://github.com/apache/logging-log4net/blob/rel/1.2.15/src/Config/XmlConfigurator.cs#L143
https://github.com/apache/logging-log4net/blob/rel/1.2.15/src/Config/XmlConfigurator.cs#L180
Please let me know if this helps. We also tried to generate load (>250 users)
in our sandbox servers but unable to reproduce this issue. Were you be able to
reproduce this issue at your end with this version (1.2.15) and with multiple
processes writing the same log file?
Thanks!
> IndexOutOfRangeException | I/O race condition issue still occurred with
> Log4net v.1.2.15
> ----------------------------------------------------------------------------------------
>
> Key: LOG4NET-582
> URL: https://issues.apache.org/jira/browse/LOG4NET-582
> Project: Log4net
> Issue Type: Bug
> Affects Versions: 1.2.15
> Environment: Production
> Reporter: Durgesh Khandal
> Priority: Blocker
>
> Hi, we got an incident in our Production CMS server (web application) related
> to log4net due to which it went down and we had to recycle the app-pool to
> fix it. Please find below exception details:
> 6524 03:18:42 ERROR Application error.
> Exception: System.IndexOutOfRangeException
> Message: Probable I/O race condition detected while copying memory. The I/O
> package is not thread safe by default. In multithreaded applications, a
> stream must be accessed in a thread-safe way, such as a thread-safe wrapper
> returned by TextReader's or TextWriter's Synchronized methods. This also
> applies to classes like StreamWriter and StreamReader.
> Source: mscorlib
> at System.Buffer.InternalBlockCopy(Array src, Int32 srcOffsetBytes, Array
> dst, Int32 dstOffsetBytes, Int32 byteCount)
> at System.IO.StreamWriter.Write(Char[] buffer, Int32 index, Int32 count)
> at System.IO.TextWriter.SyncTextWriter.WriteLine(String value)
> at log4net.helpers.LogLog.EmitErrorLine(String msg)
> at log4net.helpers.LogLog.Error(String msg)
> at log4net.Config.XmlConfigurator.Configure(ILoggerRepository repository)
> at Web.Infrastructure.Logger.Log4NetLogger..ctor(String loggerName)
> at Web.Extensions.Helpers.GenericHelper.SetCampaignCookie()
> at Web.MvcApplication.Application_BeginRequest(Object sender, EventArgs e)
> at
> System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
> at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
> completedSynchronously)
> This is the first time we met with this error. I tried to look into this and
> found below resources which says this issue was fixed in v.1.2.10.
> http://apache-logging.6191.n7.nabble.com/Uncaught-IndexOutOfRangeException-in-log4net-1-2-9-Beta-td20624.html
> But we are using the latest version 1.2.15 with the below configuration.
> <log4net>
> <logger name="CustomLogger">
> <level value="ALL"/>
> <appender-ref ref="CustomLogger" />
> </logger>
> <appender name="CustomLogger"
> type="log4net.Appender.RollingFileAppender, Sitecore.Logging">
> <!--Do not change the file name format [{date}]-->
> <file value="$(logFolderPath)/logs/CustomLogger.log"/>
> <rollingStyle value="Composite" />
> <datePattern value=".yyyyMMdd.HHmmss.'txt'" />
> <appendToFile value="true"/>
> <preserveLogFileNameExtension value="true" />
> <staticLogFileName value="false" />
> <maxSizeRollBackups value="60" />
> <maximumFileSize value="10MB" />
> <lockingModel type="log4net.Appender.FileAppender+MinimalLock"
> />
> <dateTimeStrategy
> type="log4net.Appender.RollingFileAppender+UniversalDateTime" />
> <layout type="log4net.Layout.PatternLayout">
> <conversionPattern value="%4t %d{ABSOLUTE} %-5p %m%n"/>
> </layout>
> <encoding value="utf-8"/>
> </appender>
> </log4net>
> In our IIS application app-pool, maximum worker process is also set to 1.
> Can you please help and suggest a fix/prevention tips to avoid this error
> again in future? Please let me know if you need more details.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)