You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Durgesh Khandal (JIRA)" <ji...@apache.org> on 2017/12/04 08:47:00 UTC

[jira] [Commented] (LOG4NET-582) IndexOutOfRangeException | I/O race condition issue still occurred with Log4net v.1.2.15

    [ https://issues.apache.org/jira/browse/LOG4NET-582?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16276456#comment-16276456 ] 

Durgesh Khandal commented on LOG4NET-582:
-----------------------------------------

The ticket is not yet assigned to anyone. Is this JIRA project account still active?

> 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)