tls: forward keepAlive, keepAliveInitialDelay, noDelay to socket#62004
tls: forward keepAlive, keepAliveInitialDelay, noDelay to socket#62004tadjik1 wants to merge 1 commit intonodejs:mainfrom
Conversation
|
Review requested:
|
| // Retrieve internal symbols used by net.Socket to store socket options. | ||
| const symbols = Object.getOwnPropertySymbols(new net.Socket()); | ||
| const kSetNoDelay = symbols.find((s) => s.toString() === 'Symbol(kSetNoDelay)'); | ||
| const kSetKeepAlive = | ||
| symbols.find((s) => s.toString() === 'Symbol(kSetKeepAlive)'); | ||
| const kSetKeepAliveInitialDelay = | ||
| symbols.find((s) => s.toString() === 'Symbol(kSetKeepAliveInitialDelay)'); |
There was a problem hiding this comment.
Is it worth just moving the symbols to internal/net so that we can access them for testing?
There was a problem hiding this comment.
Thanks @Renegade334, good idea. Moved those 3 Symbols to internal/net and replaced this part of the test with simple import.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #62004 +/- ##
=======================================
Coverage 89.72% 89.73%
=======================================
Files 676 676
Lines 205988 205997 +9
Branches 39490 39487 -3
=======================================
+ Hits 184830 184846 +16
- Misses 13295 13298 +3
+ Partials 7863 7853 -10
🚀 New features to boost your workflow:
|
|
It seems like pre-existing flake, I see this test ( 10ms for the timeout is probably too sensitive to CI network. |
addaleax
left a comment
There was a problem hiding this comment.
LGTM
Can the commit message be updated with the context from the PR description? Rebasing/amending commits is fine 🙂
`tls.connect()` silently ignores `keepAlive`, `keepAliveInitialDelay`, and `noDelay` options. The documentation states it accepts any `socket.connect()` option, and `net.createConnection()` with the same options works correctly. Forward the options through both code paths so `net.Socket`'s constructor stores them on the internal symbols (`kSetNoDelay`, `kSetKeepAlive`, `kSetKeepAliveInitialDelay`), which `afterConnect()` then applies to the handle. Fixes: nodejs#62003
e4c82ea to
a373f56
Compare
Summary
tls.connect()silently ignoreskeepAlive,keepAliveInitialDelay, andnoDelayoptions. The documentation states it accepts anysocket.connect()option, andnet.createConnection()with the same options works correctly.This forwards the options through both points so
net.Socket's constructor stores them on the internal symbols (kSetNoDelay,kSetKeepAlive,kSetKeepAliveInitialDelay), whichafterConnect()then applies to the handle.Fixes: #62003
I believe this is a good candidate for backport, as it fixes a silent options-dropping bug in
tls.connect()that affectskeepAlive/noDelaybehavior (in particular with AWS Lambda on 20.x runtime).