fsprojects / fsprojects/FsHttp
Port exhaustion regression
Nobody has claimed this yet.
- Dominant language
- F#
- Stars
- 498
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Description
Using FsHttp with the default httpClientFactory on an Azure Web App to send many HTTP requests to the same domain results in SNAT port exhaustion, with the error
System.Net.Sockets.SocketException (10060): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
From what I can tell, this is because the default factory will create a new HttpClient instance for each request. Microsoft documentation states that if you are not using HttpClientFactory with DI, you should have a singleton HttpClient for the lifetime of your application to avoid the port exhaustion problem.
It looks like this problem was fixed in #37, but then reintroduced later.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the default httpClientFactory behavior described in the issue and compare it with the change referenced in #37. Reproduce many requests to the same domain, ideally in the Azure Web App scenario, then verify the default behavior avoids creating a new client for every request and prevents the reported SNAT exhaustion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fsharp
- Domain
- backend, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100