Azure / durabletask

Durable Task Framework allows users to write long running persistent workflows in C# using the async/await capabilities.
Apache License 2.0
1.51k stars 290 forks source link

SF Provider: memory leak: Create a new scope in HTTP controller DI on each BeginScope call #933

Closed NeetArt closed 1 year ago

NeetArt commented 1 year ago

Create a new scope in HTTP controller dependency injection on each BeginScope call

Previous implementation used a single root scope for all HTTP requests. As the scope was never disposed, so didn't the controller & HTTP request/response objects, causing them to get accumulated in memory. This change creates a new scope in BeginScope() API which will be disposed by request handler when the request completes. More information can be found here: Dependency Injection in ASP.NET Web API 2 - ASP.NET 4.x | Microsoft Learn