[
https://issues.apache.org/jira/browse/LOG4NET-582?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16276508#comment-16276508
]
Stefan Bodewig commented on LOG4NET-582:
----------------------------------------
The mailing list thread you link to has a different stack trace from log4net's
side, so you are hitting a similar but different issue (that nobody has
investigated in detail so far).
Most likely the suggestion of disabling the internal logging would prevent the
particular exception, but I'm afraid there is some deeper problem as log4net
tries to log an error.
Unfortunately I cannot match the stack trace to the code of 1.2.15 (which by
far is not the latest release of log4net, 2.0.8 is) as I don't see any call of
{{LogLog.Error}} in {{XmlConfigurator.Configure(ILoggerRepository repository)}}
at all.
https://github.com/apache/logging-log4net/blob/rel/1.2.15/src/Config/XmlConfigurator.cs#L137
The stack trace would perfectly well match log4net 1.2.9
(https://github.com/apache/logging-log4net/blob/rel/1.2.9/src/Config/XmlConfigurator.cs#L160
for example). So you may want to verify you are not actually using log4net
1.2.9 rather than the version you think is there.
> 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)