Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-opening - The library misuse the HttpClient objects that result in a memory leak and potential socket exhaustion #304

Closed
mockjv opened this issue Apr 20, 2021 · 3 comments

Comments

@mockjv
Copy link

mockjv commented Apr 20, 2021

I've also come across the fact that this particular client doesn't offer any way to either 1) configure a custom HttpClient by way of options or the like, or 2) implement the IDisposable interface such that the constructed HttpClient is properly disposed of (ideally, the client would implement both in my opinion).

We're in a position of always wanting to address all possible leakages due to the "native application" running as a form of long-run background service, so I disagree with the previous stance that it shouldn't really ever affect native applications (what constitutes a "native application" is starting to blur thanks to Blazor, MAUI and etc).

#212

thanks for researching this. There is a long, long discussion on how to use HttpClient that spans multiple years now.

I can assure you, that the above potential problems are not real problems for native GUIs (and that's what this library is targeting).

Yes, technically the number of times it is ever invoked should be relatively small but again with a background long-running service, we'd like to always address a potential leakage.

That said, being that the previous issue went stale would it just be a matter of proposing improvements to allow for providing a client and implementing IDisposable?

@CarlG12

@jimm98y
Copy link

jimm98y commented Jul 13, 2021

We've also run into this issue when we tried to use the DLL inside Unity WebGL app. HttpClient from System.Net namespace does not work in Unity WebGL and it is necessary to use UnityWebRequest instead. Having an interface which we could implement using any HTTP client (UnityWebRequest in this case) would have been nice. In UWP, it might be also desirable to use Windows.Web.HttpClient which has more features than the System.Net.HttpClient.

@leastprivilege
Copy link
Contributor

I added a callback to integrate with arbitrary HTTP client creation strategies - would that help?

#327

I am closing this issue - feel free to comment on the PR.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants