-
-
Notifications
You must be signed in to change notification settings - Fork 35.8k
setkeepalive < 1000 silently ignored #57712
Copy link
Copy link
Open
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.netIssues and PRs related to the net subsystem.Issues and PRs related to the net subsystem.
Description
Metadata
Metadata
Assignees
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.netIssues and PRs related to the net subsystem.Issues and PRs related to the net subsystem.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Version
22.14.0
Platform
Subsystem
No response
What steps will reproduce the bug?
Create a TCP socket and call
socket.setKeepAlive(true, 400).How often does it reproduce? Is there a required condition?
Any keepalive less than 1 second.
What is the expected behavior? Why is that the expected behavior?
This should send keepalive packets every 400 ms.
The documentation says as much:
What do you see instead?
The code truncates to the nearest 1000ms, so the socket doesn't send keepalive packets and no error is issued.
Additional information
It seems this parameter is even broken in the tests.
node/test/parallel/test-net-keepalive.js
Line 42 in 3db5491
node/test/parallel/test-net-persistent-keepalive.js
Line 30 in 3db5491
Ideally, the keepalive interval would be respected in milliseconds. Assuming that's infeasible,