Manipulating TCP keep-alive settings
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 58
- Forks
- 35
- Avg merge
- 22h 4m
- Merged PRs (30d)
- 10
Description
I ran into an issue recently where a client was stuck waiting on a host that had crashed and rebooted, but never ended the connection because there wasn't any TCP traffic. This situation could have been detected and remedied earlier by configuring the TCP connection to send keep-alive probes. I took a look, and Restify currently has an option _keep_alive which will enable keep-alive on the socket. It would be nice if there was a way to also set the initial delay (TCP_KEEPIDLE) in sending the probe (the second argument to .setKeepAlive()).
I don't know exactly what the interface should look like, but it could be something along the lines of:
{
"keep_alive": {
"initial_delay": <milliseconds>
}
}
(Or perhaps just replace _keep_alive. Since _keep_alive doesn't seem to be currently documented, and it starts with an underbar, I'm guessing it's not considered a stable option?)
If node ever grows a way to also set TCP_KEEPCNT and TCP_KEEPINTVL, then additional fields could be added to the object for manipulating those parameters on the socket.
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 existing _keep_alive option to the socket’s .setKeepAlive() call, then check the Node.js API for support for the initial delay and related TCP settings. The interface is not settled; done means documenting and implementing a clear configuration path that sets the requested delay, with tests covering the resulting socket behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100