setkeepalive < 1000 silently ignored
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 122k
- フォーク
- 37.3k
- 平均マージ
- 4日 2時間
- マージ済み PR(30日)
- 283
説明
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 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:
keepAliveInitialDelay{number} If set to a positive number, it sets the
initial delay before the first keepalive probe is sent on an idle socket.
Default:0.
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.
https://github.com/nodejs/node/blob/3db54912fa2e4a696d4e2ec27dfb2aeecfc65191/test/parallel/test-net-keepalive.js#L42
https://github.com/nodejs/node/blob/3db54912fa2e4a696d4e2ec27dfb2aeecfc65191/test/parallel/test-net-persistent-keepalive.js#L30
Ideally, the keepalive interval would be respected in milliseconds. Assuming that's infeasible,
- a runtime warning should be issued if setKeepAlive is given a value <1000.
- the documentation should be updated to reflect that, even though the value is given in milliseconds, it will only be respected to the second.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Start at the socket.setKeepAlive(true, 400) entry point and inspect the behavior covered by test/parallel/test-net-keepalive.js and test/parallel/test-net-persistent-keepalive.js. Determine whether subsecond delays should be supported or rejected, then update the relevant tests and documentation so the chosen behavior is explicit and verified.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, node.js
- 領域
- networking
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 活発
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 64/100