Describe the bug
We're seeing consistently climbing memory usage (very slow, abuot 50MB per hour), but only on the gateway service. I've swept through the HotChocolate.Stitching code and, with the help of this extension found some cases of IDisposable instances not being disposed of potentially and that need reviewing.
To Reproduce
Steps to reproduce the behavior:
- Install the extension
- Investigate the following locations in code that are giving warnings (green squigglies):
HotChocolate.Stitching.Requests.StitchingContext - the ctor build a dictionary of RemoteRequestExecutor instances but never disposes of them. This is setup in DI as scoped, so the caching is only useful in the scope and they should be disposed of. Perhaps StitchingContext needs to implement IDisposable and dispose it's dictionary entries?
HotChocolate.Stitching.Requests.MergeRequestHelper::DispatchResults - IQueryResult instances are being flagged
HotChocolate.Stitching.Pipeline.HttpRequestClient::FetchAsync - IQueryResult instance being flagged
Microsoft.Extensions.DependencyInjection.HotChocolateStitchingRequestExecutorExtensions::AddRemoteSchema and AddLocalSchema - line 241 RequestExecutorProxy is being flagged though maybe these are OK as they're singleton/static in nature, only created at schema build time?
Expected behavior
Hopefully less climbing memory, though it's a very slow burn up.
Desktop (please complete the following information):
- OS: Linux alpine containers
- Version HCv11.0.8
Additional context
We've profiled with dotMemory running 10 thousand queries against the gateway, with a variation of node queries (to test my custom node resolver) and other general queries to test stitching, and not noticed anything particularly dramatic or that stands out.
Describe the bug
We're seeing consistently climbing memory usage (very slow, abuot 50MB per hour), but only on the gateway service. I've swept through the HotChocolate.Stitching code and, with the help of this extension found some cases of IDisposable instances not being disposed of potentially and that need reviewing.
To Reproduce
Steps to reproduce the behavior:
HotChocolate.Stitching.Requests.StitchingContext- the ctor build a dictionary ofRemoteRequestExecutorinstances but never disposes of them. This is setup in DI as scoped, so the caching is only useful in the scope and they should be disposed of. Perhaps StitchingContext needs to implement IDisposable and dispose it's dictionary entries?HotChocolate.Stitching.Requests.MergeRequestHelper::DispatchResults-IQueryResultinstances are being flaggedHotChocolate.Stitching.Pipeline.HttpRequestClient::FetchAsync-IQueryResultinstance being flaggedMicrosoft.Extensions.DependencyInjection.HotChocolateStitchingRequestExecutorExtensions::AddRemoteSchema and AddLocalSchema- line 241RequestExecutorProxyis being flagged though maybe these are OK as they're singleton/static in nature, only created at schema build time?Expected behavior
Hopefully less climbing memory, though it's a very slow burn up.
Desktop (please complete the following information):
Additional context
We've profiled with dotMemory running 10 thousand queries against the gateway, with a variation of node queries (to test my custom node resolver) and other general queries to test stitching, and not noticed anything particularly dramatic or that stands out.