You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Asp.Net client would keep adding the same middleware to the static _globalClient if Bugsnag.Client.Current is called outside of a request scope and call to BeginNotify() is called subsequently to add a middleware.
This results in a memory leak since _globalClient is static. When Notify() is called, this also results a very long running loop and a lot of handled exceptions due to the large number of middleware linked to the globalclient.
Steps to reproduce
Invoke a async function with ConfigureAwait(false) or use Task.Run()
Get a BugSnag client using Bugsnag.Client.Current when the HttpContext.current is no long in scope.
Add a middleware.
Repeat this across many requests
Trigger Notify() on the global client
You would see a lot of exceptions in performance counters.
Environment
Bugsnag version: N/A
.NET framework version: 4.7.2
BeforeNotify() should probably check if it is using the _globalClient and not add a middleware or middleware should be stored using a HashSet instead to prevent duplicates.
The text was updated successfully, but these errors were encountered:
Hi @oldcookie, Thanks for raising we are going to look to get this fixed. In the meantime it would be interesting to know if you've managed to work around it?
Describe the bug
Asp.Net client would keep adding the same middleware to the static
_globalClient
ifBugsnag.Client.Current
is called outside of a request scope and call toBeginNotify()
is called subsequently to add a middleware.This results in a memory leak since
_globalClient
is static. WhenNotify()
is called, this also results a very long running loop and a lot of handled exceptions due to the large number of middleware linked to the globalclient.Steps to reproduce
ConfigureAwait(false)
or use Task.Run()Bugsnag.Client.Current
when the HttpContext.current is no long in scope.You would see a lot of exceptions in performance counters.
Environment
BeforeNotify()
should probably check if it is using the_globalClient
and not add a middleware or middleware should be stored using a HashSet instead to prevent duplicates.The text was updated successfully, but these errors were encountered: