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

HttpEventCollectorSender creates thousands of sockets under load #52

Open
maxiptah opened this issue Mar 15, 2019 · 2 comments
Open

HttpEventCollectorSender creates thousands of sockets under load #52

maxiptah opened this issue Mar 15, 2019 · 2 comments

Comments

@maxiptah
Copy link

I am using your package with HttpEventCollectorTraceListener in order to send logs to Splunk from an Azure app. There are bursts in logs where thousands of messages are sent in a couple of minutes. It looks like HttpClient inside HttpEventCollectorSender is not reusing open sockets and number of sockets in TIME_WAIT is increasing rapidly. After 2 minutes the app runs out of sockets (see screenshot).

Can you please comment on this behavior? Is this expected? I'm aware that it's normal for a socket to stay in TIME_WAIT, but why new sockets are being opened? Cannot the HttpEventCollectorSender just push messages on one/several sockets that are always open?

I've tried to feed a SocketsHttpHandler into HttpEventCollectorSender with pooled connection settings, but to no avail.

image

@shakeelmohamed
Copy link
Contributor

Hi @maxiptah,

This seems like a valid issue, thanks for bringing it to our attention.
We're open to a PR if you're interested in getting this resolved sooner

@stojan00
Copy link

stojan00 commented Dec 2, 2021

I saw this issue as well it is because the HttpEventCollectorSender continually news up HttpClient() instances. A known longstanding issue with HttpClient is that each instance will take up a socket which will rapidly lead to running out of sockets when under heavy load. The solution would be to make the HttpClient static and not dispose of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants