Title: setkeepalive < 1000 silently ignored · Issue #57712 · nodejs/node · GitHub
Open Graph Title: setkeepalive < 1000 silently ignored · Issue #57712 · nodejs/node
X Title: setkeepalive < 1000 silently ignored · Issue #57712 · nodejs/node
Description: Version 22.14.0 Platform N/A 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 seco...
Open Graph Description: Version 22.14.0 Platform N/A 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 c...
X Description: Version 22.14.0 Platform N/A 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 c...
Opengraph URL: https://github.com/nodejs/node/issues/57712
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"setkeepalive \u003c 1000 silently ignored","articleBody":"### Version\n\n22.14.0\n\n### Platform\n\n```text\nN/A\n```\n\n### Subsystem\n\n_No response_\n\n### What steps will reproduce the bug?\n\nCreate a TCP socket and call `socket.setKeepAlive(true, 400)`.\n\n### How often does it reproduce? Is there a required condition?\n\nAny keepalive less than 1 second.\n\n### What is the expected behavior? Why is that the expected behavior?\n\nThis should send keepalive packets every 400 ms.\n\nThe documentation says as much:\n\u003e `keepAliveInitialDelay` {number} If set to a positive number, it sets the\n initial delay before the first keepalive probe is sent on an idle socket.\n **Default:** `0`.\n\n### What do you see instead?\n\nThe code truncates to the nearest 1000ms, so the socket doesn't send keepalive packets and no error is issued.\n\n\n### Additional information\n\nIt seems this parameter is even broken in the tests.\n\nhttps://github.com/nodejs/node/blob/3db54912fa2e4a696d4e2ec27dfb2aeecfc65191/test/parallel/test-net-keepalive.js#L42\nhttps://github.com/nodejs/node/blob/3db54912fa2e4a696d4e2ec27dfb2aeecfc65191/test/parallel/test-net-persistent-keepalive.js#L30\n\nIdeally, the keepalive interval would be respected in milliseconds. Assuming that's infeasible,\n1. a runtime warning should be issued if setKeepAlive is given a value \u003c1000.\n2. the documentation should be updated to reflect that, even though the value is given in milliseconds, it will only be respected to the second.","author":{"url":"https://github.com/rotu","@type":"Person","name":"rotu"},"datePublished":"2025-04-01T17:13:27.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/57712/node/issues/57712"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:42c5625d-740b-3a7f-cf20-2c21b112e4ff |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DE50:2B7EEA:B6A9E9:FF6BF2:6A4CA16A |
| html-safe-nonce | 7f1f7d956e61941c678c57d52c74b0e59778a3a66fc8a25e57b3fc32863eed59 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERTUwOjJCN0VFQTpCNkE5RTk6RkY2QkYyOjZBNENBMTZBIiwidmlzaXRvcl9pZCI6IjI5NTg5NDQ4ODI0NzU4NjM0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 38d5f2f8d21b97d5277755ed50b523d46889b66fae0760d55e1fcc6fe7a141be |
| hovercard-subject-tag | issue:2964062166 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/57712/issue_layout |
| twitter:image | https://opengraph.githubassets.com/dbb24190589b523ed8315bdc8cf885371fea2bf8e4e577c7f7f2975ee19bd403/nodejs/node/issues/57712 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/dbb24190589b523ed8315bdc8cf885371fea2bf8e4e577c7f7f2975ee19bd403/nodejs/node/issues/57712 |
| og:image:alt | Version 22.14.0 Platform N/A 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 c... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rotu |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ae90d426644ca15e89bacceb72e51f4e9dbf85f7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width