Skip to content

AsyncTaskTarget - Retry on Exception - MemoryLeak? #5664

@IAMJDA

Description

@IAMJDA

NLog version: latest dev

I noticed an issue with the AsyncTaskTarget. Due to an exception, the actual WriteSyncTask didn't complete.
Log: Warn xxxLog: WriteAsyncTask failed on completion. Sleep 500 ms Exception: XXX

I assume the tasks where repeated all the time and therefore, the memory used grow over time.
I checked whether I can disable the Retry and there is a RetryCount property in AsyncTaskTarget. But I'm either blind or it's never reduced see https://github.com/NLog/NLog/blob/dev/src/NLog/Targets/AsyncTaskTarget.cs#L720

else if (actualException != null) { success = false; if (RetryCount <= 0) { if (RetryFailedAsyncTask(actualException, CancellationToken.None, 0, out var retryDelay)) { InternalLogger.Warn(actualException, "{0}: WriteAsyncTask failed on completion. Sleep {1} ms", this, retryDelay.TotalMilliseconds); AsyncHelpers.WaitForDelay(retryDelay); } }

It might be that the retry logic in the other functions is handling this, but the end result was a fully used server with a lot of strings (in terms of GB) having a root somewhere in the logging logic.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions