Skip to content

StackOverflowException using v 5.0.0 (fixed in 5.0.1) #148

Closed
serilog/serilog
#1977
@NarinderPalIAPA

Description

@NarinderPalIAPA

I've updated to 5.0.0. I have a background application that does a lot of logging and it does it in parallel in many threads. I observed a stack overflow and the pod (open shift ubi image version 8.8) crashed -

Image is prepared with .net 7, runs on open shift environment, version 8.

Stack overflow is observed while writing a large json string to console log.

Below is the stack trace -

Stack overflow.
Repeat 74789 times:
--------------------------------
   at Serilog.Rendering.ReusableStringWriter.Dispose(Boolean)
   at System.IO.TextWriter.Dispose()
--------------------------------
   at Serilog.Events.MessageTemplate.Render(System.Collections.Generic.IReadOnlyDictionary`2<System.String,Serilog.Events.LogEventPropertyValue>, System.IFormatProvider)
   at Serilog.Events.LogEvent.RenderMessage(System.IFormatProvider)
   at Elastic.CommonSchema.Serilog.LogEventConverter.ConvertToEcs[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Serilog.Events.LogEvent, Elastic.CommonSchema.Serilog.IEcsTextFormatterConfiguration`1<System.__Canon>)
   at Elastic.CommonSchema.Serilog.EcsTextFormatter`1[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Format(Serilog.Events.LogEvent, System.IO.TextWriter)
   at Serilog.Sinks.SystemConsole.ConsoleSink.Emit(Serilog.Events.LogEvent)
   at Serilog.Core.Sinks.SafeAggregateSink.Emit(Serilog.Events.LogEvent)
   at Serilog.Core.Logger.Dispatch(Serilog.Events.LogEvent)
   at Serilog.Core.Logger.Serilog.Core.ILogEventSink.Emit(Serilog.Events.LogEvent)
   at Serilog.Core.Logger.Dispatch(Serilog.Events.LogEvent)
   at Serilog.Core.Logger.Write(Serilog.Events.LogEventLevel, System.Exception, System.String, System.ReadOnlySpan`1<System.Object>)
   at Serilog.Core.Logger.Write(Serilog.Events.LogEventLevel, System.String, System.ReadOnlySpan`1<System.Object>)
   at Serilog.Core.Logger.Write[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Serilog.Events.LogEventLevel, System.String, System.__Canon)
   at Serilog.Core.Logger.Debug[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.String, System.__Canon)
   at ABB.PAM.ConditionMonitoringEngine.Core.InstanceManager+<ProcessConfigurationUpdate>d__51.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[ABB.PAM.ConditionMonitoringEngine.Core.InstanceManager+<ProcessConfigurationUpdate>d__51, ABB.PAM.CME, Version=1.6.0.0, Culture=neutral, PublicKeyToken=null]](<ProcessConfigurationUpdate>d__51 ByRef)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[ABB.PAM.ConditionMonitoringEngine.Core.InstanceManager+<ProcessConfigurationUpdate>d__51, ABB.PAM.CME, Version=1.6.0.0, Culture=neutral, PublicKeyToken=null]](<ProcessConfigurationUpdate>d__51 ByRef)
   at ABB.PAM.ConditionMonitoringEngine.Core.InstanceManager.ProcessConfigurationUpdate(Newtonsoft.Json.Linq.JObject)
   at ABB.PAM.ConditionMonitoringEngine.Core.InstanceManager+<HandleConfigurationUpdate>d__23.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[ABB.PAM.ConditionMonitoringEngine.Core.InstanceManager+<HandleConfigurationUpdate>d__23, ABB.PAM.CME, Version=1.6.0.0, Culture=neutral, PublicKeyToken=null]](<HandleConfigurationUpdate>d__23 ByRef)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[ABB.PAM.ConditionMonitoringEngine.Core.InstanceManager+<HandleConfigurationUpdate>d__23, ABB.PAM.CME, Version=1.6.0.0, Culture=neutral, PublicKeyToken=null]](<HandleConfigurationUpdate>d__23 ByRef)
   at ABB.PAM.ConditionMonitoringEngine.Core.InstanceManager.HandleConfigurationUpdate(System.String)
   at ABB.PAM.ConditionMonitoringEngine.Core.InstanceManager+<OnModelUpdate>d__13.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[ABB.PAM.ConditionMonitoringEngine.Core.InstanceManager+<OnModelUpdate>d__13, ABB.PAM.CME, Version=1.6.0.0, Culture=neutral, PublicKeyToken=null]](<OnModelUpdate>d__13 ByRef)
   at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[[ABB.PAM.ConditionMonitoringEngine.Core.InstanceManager+<OnModelUpdate>d__13, ABB.PAM.CME, Version=1.6.0.0, Culture=neutral, PublicKeyToken=null]](<OnModelUpdate>d__13 ByRef)
   at ABB.PAM.ConditionMonitoringEngine.Core.InstanceManager.OnModelUpdate(System.Object, ABB.PAM.ConditionMonitoringEngine.Services.ModelUpdateEventArgs)
   at ABB.PAM.ConditionMonitoringEngine.Core.InstanceManager+<>c__DisplayClass22_0.<HandleConfigurationUpdateFromLocalCache>b__0()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task+<>c.<.cctor>b__273_0(System.Object)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread)
   at System.Threading.Tasks.Task.ExecuteEntryUnsafe(System.Threading.Thread)
   at System.Threading.Tasks.Task.ExecuteFromThreadPool(System.Threading.Thread)
   at System.Threading.ThreadPoolWorkQueue.DispatchWorkItem(System.Object, System.Threading.Thread)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()
   at System.Threading.Thread+StartHelper.RunWorker()
   at System.Threading.Thread+StartHelper.Run()
   at System.Threading.Thread.StartCallback()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions