[v18.x backport] net: fix address iteration with autoSelectFamily
When autoSelectFamily is set to true, net.connect is supposed to
try connecting to both IPv4 and IPv6, interleaving the address types.
Instead, it appears that the array that holds the addresses in the order
they should be attempted was never used after being populated.
PR-URL: https://github.com/nodejs/node/pull/48258 Backport-PR-URL: https://github.com/nodejs/node/pull/48275 Reviewed-By: Paolo Insogna [email protected] Reviewed-By: Colin Ihrig [email protected] Reviewed-By: Tobias NieΓen [email protected] Reviewed-By: Luigi Pinca [email protected] Reviewed-By: Juan JosΓ© Arboleda [email protected]
This also includes the backport of https://github.com/nodejs/node/pull/45777 which is required for this :)
Review requested:
- [ ] @nodejs/net
CI: https://ci.nodejs.org/job/node-test-pull-request/52038/
Hey @indutny @ShogunPanda, I believe the introduced test for https://github.com/nodejs/node/pull/48258 is covered by this, https://github.com/nodejs/node/pull/48275/files#diff-c97855fe951a3d9c4319418be09b97f6c2700565dbc65c47adfb3f520e8759e6R175 right?
@juanarbol Nope, it's not. That test only included those addresses already in order, so there was no verification the attempt order was correct. In #48258 a test has been specifically included to verify the behavior.
CI: https://ci.nodejs.org/job/node-test-pull-request/52136/ π
CI: https://ci.nodejs.org/job/node-test-pull-request/52137/ π
@ShogunPanda PTAL :-)
CI: https://ci.nodejs.org/job/node-test-pull-request/52138/ π
This is hitting known flakes, see: https://github.com/nodejs/node/issues/48300
CI: https://ci.nodejs.org/job/node-test-pull-request/52149/
CI: https://ci.nodejs.org/job/node-test-pull-request/52152/
CI: https://ci.nodejs.org/job/node-test-pull-request/52166/ π
I don't think CI will be happy until the windows issue is solved; most jobs fail at this point. I prefer to wait for a bit more to kick a CI again.
Or feel free to retry if needed.
CI: https://ci.nodejs.org/job/node-test-pull-request/52215/
CI: https://ci.nodejs.org/job/node-test-pull-request/52232/
CI: https://ci.nodejs.org/job/node-test-pull-request/52244/
CI: https://ci.nodejs.org/job/node-test-pull-request/52246/
CI: https://ci.nodejs.org/job/node-test-pull-request/52247/
CI: https://ci.nodejs.org/job/node-test-pull-request/52257/
CI: https://ci.nodejs.org/job/node-test-pull-request/52316/
@ShogunPanda The failure is persistent; not quite sure why. Do you believe we just have bad luck? Or it could be something else
I think it's bad luck. None of the failures seems to be related to this change. :(
CI: https://ci.nodejs.org/job/node-test-pull-request/52481/
CI: https://ci.nodejs.org/job/node-test-pull-request/52501/
CI: https://ci.nodejs.org/job/node-test-pull-request/52503/
CI: https://ci.nodejs.org/job/node-test-pull-request/52520/
CI: https://ci.nodejs.org/job/node-test-pull-request/52578/
CI: https://ci.nodejs.org/job/node-test-pull-request/52605/
CI: https://ci.nodejs.org/job/node-test-pull-request/52625/
@ShogunPanda I think we made it π