Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socket.remoteAddress is always undefined once called before connect #43009

Closed
szmarczak opened this issue May 8, 2022 · 0 comments · Fixed by #43010
Closed

socket.remoteAddress is always undefined once called before connect #43009

szmarczak opened this issue May 8, 2022 · 0 comments · Fixed by #43010
Labels
net Issues and PRs related to the net subsystem.

Comments

@szmarczak
Copy link
Member

szmarczak commented May 8, 2022

Version

v18.1.0

Platform

Linux pop-os 5.16.19-76051619-generic #202204081339~1649696161~21.10~091f44b SMP PREEMPT Mon Apr 11 17 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

net

What steps will reproduce the bug?

const net = require('net');

const socket = net.connect(443, 'example.com');

console.log(socket.connecting, socket.remoteAddress);

socket.on('connect', () => {
    console.log(socket.remoteAddress);
});

How often does it reproduce? Is there a required condition?

Always. Regressed since v15.0.0.

What is the expected behavior?

true undefined
[IP]

What do you see instead?

true undefined
undefined

Additional information

Looks like the culprit is 1428db8

daeyeon added a commit to daeyeon/node that referenced this issue May 8, 2022
Fixes: nodejs#43009

If calling `this._handle.getpeername` returns an error at the first
call, its result shouldn't be cached to `this._peername`.

Signed-off-by: Daeyeon Jeong [email protected]
daeyeon added a commit to daeyeon/node that referenced this issue May 8, 2022
Fixes: nodejs#43009

If calling `this._handle.getpeername` returns an error at the first
call, its result shouldn't be cached to `this._peername`.

Signed-off-by: Daeyeon Jeong [email protected]
@VoltrexKeyva VoltrexKeyva added the net Issues and PRs related to the net subsystem. label May 8, 2022
daeyeon added a commit to daeyeon/node that referenced this issue May 23, 2022
Fixes: nodejs#43009

If calling `this._handle.getpeername` returns an error at the first
call, its result shouldn't be cached to `this._peername`.

Signed-off-by: Daeyeon Jeong [email protected]
nodejs-github-bot pushed a commit that referenced this issue Jul 25, 2022
Fixes: #43009

If calling `this._handle.getpeername` returns an error at the first
call, its result shouldn't be cached to `this._peername`.

Signed-off-by: Daeyeon Jeong [email protected]

PR-URL: #43010
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Zeyu "Alex" Yang <[email protected]>
danielleadams pushed a commit that referenced this issue Jul 26, 2022
Fixes: #43009

If calling `this._handle.getpeername` returns an error at the first
call, its result shouldn't be cached to `this._peername`.

Signed-off-by: Daeyeon Jeong [email protected]

PR-URL: #43010
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Zeyu "Alex" Yang <[email protected]>
targos pushed a commit that referenced this issue Jul 31, 2022
Fixes: #43009

If calling `this._handle.getpeername` returns an error at the first
call, its result shouldn't be cached to `this._peername`.

Signed-off-by: Daeyeon Jeong [email protected]

PR-URL: #43010
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Zeyu "Alex" Yang <[email protected]>
targos pushed a commit that referenced this issue Jul 31, 2022
Fixes: #43009

If calling `this._handle.getpeername` returns an error at the first
call, its result shouldn't be cached to `this._peername`.

Signed-off-by: Daeyeon Jeong [email protected]

PR-URL: #43010
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Zeyu "Alex" Yang <[email protected]>
targos pushed a commit that referenced this issue Aug 1, 2022
Fixes: #43009

If calling `this._handle.getpeername` returns an error at the first
call, its result shouldn't be cached to `this._peername`.

Signed-off-by: Daeyeon Jeong [email protected]

PR-URL: #43010
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Zeyu "Alex" Yang <[email protected]>
Fyko pushed a commit to Fyko/node that referenced this issue Sep 15, 2022
Fixes: nodejs#43009

If calling `this._handle.getpeername` returns an error at the first
call, its result shouldn't be cached to `this._peername`.

Signed-off-by: Daeyeon Jeong [email protected]

PR-URL: nodejs#43010
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Zeyu "Alex" Yang <[email protected]>
guangwong pushed a commit to noslate-project/node that referenced this issue Oct 10, 2022
Fixes: nodejs/node#43009

If calling `this._handle.getpeername` returns an error at the first
call, its result shouldn't be cached to `this._peername`.

Signed-off-by: Daeyeon Jeong [email protected]

PR-URL: nodejs/node#43010
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Zeyu "Alex" Yang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
net Issues and PRs related to the net subsystem.
Projects
None yet
2 participants