tcp connections taking too long to close
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 880
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 68
Description
Bug Description
We recently migrated our http client from request-promise-native to undici on our GraphQL server. We have observed significant performance gains 🎉.
- Our GraphQL server connects through upstream micro-services through HTTP connection.
- After this migration we observed that connections between GraphQL and upstream services are not draining on regular interval.
- Upstream services are deployed using blue green deployments.
- Even after we deploy new stack of upstream service, there are connection open on older stack for more than 1.5 hrs.
Is there a config to specify to drain the TCP connections on certain intervals
Additional context
Sample Code-
import {IncomingHttpHeaders} from 'http'
import {request} from 'undici'
export const nativePostRequest = async (
url: string,
headers: IncomingHttpHeaders,
body: any,
extra: string
) => {
const bodyString = JSON.stringify(body)
return await request(url, {
method: 'POST',
headers: headers,
body: bodyString,
bodyTimeout: config.httpTimeout
})
}
Contributor guide
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 with the sample request(url, ...) entry point and investigate how Undici manages HTTP/TCP connection lifetimes after requests complete. Check whether the client exposes a documented drain or interval setting, and verify any finding against the blue-green deployment scenario described. Done means identifying a supported configuration or clearly documenting the limitation and expected connection behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100