masking.serilog icon indicating copy to clipboard operation
masking.serilog copied to clipboard

Issue with Refit Exception

Open selmiskr opened this issue 4 years ago • 2 comments

GIVEN an (internal or external) API AND this API returns an exception on a certain endpoint GIVEN a console application with using refit to call this API and this certain endpoint AND Serilog is used for logging AND Exception details on Serilog is enabled AND this library is used for masking logs THEN catching an exception from this certain endpoint AND logging this exception

This will give an out of memory exception, because the masking library is trying to log the RefitSettings from the exception to the Exception details in Serilog. Because this RefitSettings contains circular references this keeps on hogging memory until the machines goes out of memory.

In this case it only happens on Refit, but I can imagine other libraries in combination with masking that can cause this.

selmiskr avatar Dec 30 '20 12:12 selmiskr

Hi, got circular reference with Dataset object too...

It's possible to add a max depth to prevent this problem on production environments?

Thanks !

image

anisite avatar Apr 30 '21 12:04 anisite

Hi @siskender - we were randomly having a service of ours become unresponsive and eventually crash with an Out Of Memory Exception, it was only occurring when a Grpc exception was being logged, so it wasn't a usual occurrence! Perhaps this max depth should be much less by default as this is a really frustrating issue to encounter! thanks

simonpinn avatar Aug 17 '21 06:08 simonpinn