Skip to content

Commit

Permalink
RavenDB-21888 We are not able to detect the leak of HttpCacheItem bas…
Browse files Browse the repository at this point in the history
…ed on the finalizer. Those items are supposed to be disposed on the disposal of a request executor. We already have the finalizer defined in RequestExecutor. The order of finalizers isn't guaranteed and we've confimed that the finalizer of HttpCacheItem might be called before the finalizer of RequestExecutor.
  • Loading branch information
arekpalinski committed Jan 9, 2024
1 parent f603d0b commit 0d8fe8f
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions src/Raven.Client/Http/HttpCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ public void ReleaseRef()
}
Allocation = null;

GC.SuppressFinalize(this);

if (Logger.IsInfoEnabled)
{
Logger.Info($"Released item from cache. Total cache size: {Cache._totalSize}");
Expand All @@ -118,18 +116,6 @@ public void Dispose()
{
ReleaseRefInternal();
}
#if !RELEASE
~HttpCacheItem()
{
Allocation = null;

// Hitting this on DEBUG and/or VALIDATE and getting a higher number than 0 means we have a leak.
// On release we will leak, but wont crash.
if (_usages > 0)
throw new LowMemoryException("Detected a leak on HttpCache when running the finalizer. See: https://issues.hibernatingrhinos.com/issue/RavenDB-9737");

}
#endif
}

/// <summary>
Expand Down

0 comments on commit 0d8fe8f

Please sign in to comment.