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

Manipulating TCP keep-alive settings #43

Open
melloc opened this issue May 13, 2016 · 2 comments
Open

Manipulating TCP keep-alive settings #43

melloc opened this issue May 13, 2016 · 2 comments

Comments

@melloc
Copy link
Contributor

melloc commented May 13, 2016

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.

@Stono
Copy link

Stono commented Oct 17, 2016

+1 for this, I have a situation where I effectively want to disable tcp keep alive

@Stono
Copy link

Stono commented Oct 17, 2016

@melloc

    server.server.on('connection', (socket) => {
      socket.setTimeout(timeout);
    });

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

2 participants