question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OutOfMemoryException

See original GitHub issue

Describe the bug We are using this sink to push data into Logstash, however we get out of memory exception. I want to understand if this exception can be raised when logstash is slow in processing data, we do push data from many PCs. Also, this exception ends up crashing the application.

Is there anything in 8.0 version that could help?

2021-05-18T11:01:25.5710337Z Exception while emitting periodic batch from Serilog.Sinks.Http.Private.Sinks.HttpSink: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at System.Text.StringBuilder.ToString()
   at System.IO.StringWriter.ToString()
   at Serilog.Sinks.Http.Private.Sinks.HttpSink.FormatPayload(IEnumerable`1 logEvents)
   at Serilog.Sinks.Http.Private.Sinks.HttpSink.<EmitBatchAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Serilog.Sinks.PeriodicBatching.PeriodicBatchingSink.<OnTick>d__21.MoveNext()
2021-05-18T11:01:28.2768308Z Exception while emitting periodic batch from Serilog.Sinks.Http.Private.Sinks.HttpSink: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at System.Text.StringBuilder.ToString()
   at System.IO.StringWriter.ToString()
   at Serilog.Sinks.Http.Private.Sinks.HttpSink.FormatPayload(IEnumerable`1 logEvents)
   at Serilog.Sinks.Http.Private.Sinks.HttpSink.<EmitBatchAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Serilog.Sinks.PeriodicBatching.PeriodicBatchingSink.<OnTick>d__21.MoveNext()
2021-05-18T11:01:38.9878217Z Exception while emitting periodic batch from Serilog.Sinks.Http.Private.Sinks.HttpSink: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at System.Text.StringBuilder.ToString()
   at System.IO.StringWriter.ToString()
   at Serilog.Sinks.Http.Private.Sinks.HttpSink.FormatPayload(IEnumerable`1 logEvents)
   at Serilog.Sinks.Http.Private.Sinks.HttpSink.<EmitBatchAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Serilog.Sinks.PeriodicBatching.PeriodicBatchingSink.<OnTick>d__21.MoveNext()

Desktop (please complete the following information):

  • OS: Windows 10 1909
  • Version: 7.2.0

Expected behaviour

It should not crash, rather error should be logged in SelfLog

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
FantasticFiascocommented, Jun 10, 2021

The unit of queueLimit is currently number of events and not total size in bytes, which would be a lot better, and easier to reason about.

I’ll add a task that we should change the non durable sink to respect a total memory size, instead of respecting the number of events. That would make great sense. As v8 isn’t currently official yet, we should aim to include this breaking change in the release.

Thanks for the feedback!

0reactions
FantasticFiascocommented, Jun 10, 2021

Closed in favour of #203

Read more comments on GitHub >

github_iconTop Results From Across the Web

OutOfMemoryException Class (System)
When data structures or data sets that reside in memory become so large that the common language runtime is unable to allocate enough...
Read more >
C# : Out of Memory exception
Today my application threw an OutOfMemoryException . To me this was always almost impossible since I have 4GB RAM and a lot of...
Read more >
C# OutOfMemoryException
The OutOfMemoryException is a runtime exception that tells the programmer that there is no enough memory or there is a lack of contiguous...
Read more >
3.2 Understand the OutOfMemoryError Exception
Usually, this error is thrown when there is insufficient space to allocate an object in the Java heap. In this case, The garbage...
Read more >
Debugging System.OutOfMemoryException using .NET tools
To start debugging the OutOfMemoryException , I recommend you to look at your application either through the Task Manager or using perfmon.msc ....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found