Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[HttpClient] Fix memory leak in TraceableHttpClient for environments with profiling#43287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
carsonbot commentedOct 3, 2021
Hey! I think@fancyweb has recently worked with this code. Maybe they can help review this? Cheers! Carsonbot |
nicolas-grekas commentedOct 6, 2021
…Client services (nicolas-grekas)This PR was merged into the 4.4 branch.Discussion----------[HttpClient] fix missing kernel.reset tag on TraceableHttpClient services| Q | A| ------------- | ---| Branch? | 4.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets | -| License | MIT| Doc PR | -Replaces#43287Commits-------2951f53 [HttpClient] fix missing kernel.reset tag on TraceableHttpClient services
Jeroeny commentedOct 6, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Thanks for the help. It seems that with that tag, the |
nicolas-grekas commentedOct 6, 2021
That's correct, but what you want is that TraceableHttpClient is reset when calling reseton the container, which what the tag should do, isn't it? |
Jeroeny commentedOct 6, 2021
The |
nicolas-grekas commentedOct 6, 2021
is that a real world use case? as of now, resetting is supposed to be managed by the container, as resetting only a subset of leaking services makes little sense. |
Jeroeny commentedOct 6, 2021
It was for debugging a production memory leak, where we'd want to reset the profilers and leave only the memory leaks that shouldn't be there. So that we could better evaluate the production-level leak (which could for example be in a misconfigured Though I agree it's a bit of a specific use case. As far as I'm concerned the current setup is fine then, as we have enough options to approach this problem (like running a local environment in |
Uh oh!
There was an error while loading.Please reload this page.
Each
DataCollectorimplementation usually holds the Traceable versions of certain interfaces.These are used by the profiler to display the traces of calls. For long running processes, this can lead to increased memory usage over time. To prevent memory leakage, the
reset()method can be called. For example on theprofilerservice, which holds services tagged withdata_collector. Which is used by the newMessenger reset feature as well.On
reset, each DataCollector removes it's data from memory, and that of the Traceable classes that it holds. See for example theEventDataCollector.Now the
HttpClientDataCollectorseems to skip resetting the data of theTraceableHttpClient(s) that it holds. This DataCollector only resets its own data. There doesn't seem to be any other class/service callingreseton theTraceableHttpClient. Therefor it should probably be done by this DataCollector? Unless there is a specific reason this is skipped, that I'm not aware about that.I've tested this setup to confirm that without the reset on the clients, the memory keeps increasing, andwith the reset being called, the memory no longer increases.
Something else I found curious but might not be related:
Note the tag
http_client.clientbeing present.Now listing services by that tags gives none:
Though the client is injected into
data_collector.http_client, which searches services on that tag as well.