-
Notifications
You must be signed in to change notification settings - Fork 30k
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
async-hooks,net: ensure asyncId=null if no handle #13938
Conversation
Fixes #13548 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make a few edits? Also, it would be perfect if you could include Fixes: https://github.com/nodejs/node/issues/13548
in the commit message itself so that the issue will automatically be closed when this is merged.
Thank you for doing this!
@nodejs/async_hooks
try { | ||
server.getConnections(() => { | ||
assert.ok(true, "No error thrown") | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you indent using 2 spaces? I think our linter complains otherwise.
@@ -0,0 +1,14 @@ | |||
'use strict'; | |||
|
|||
const assert = require('assert'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you const common = require('../common');
here?
|
||
try { | ||
server.getConnections(() => { | ||
assert.ok(true, "No error thrown") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just call server.getConnections(common.mustCall())
or server.getConnections(common.mustCall(fn))
, that’s a bit shorter (and actually makes sure that the callback gets executed) :)
} | ||
catch (e) { | ||
assert.ok(false, "getConnections threw an error"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don’t need the try/catch, if an error is thrown the test is going to fail anyway because the process crashes with an uncaught exception
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, would you prefer a comment to that effect then? I was trying to write the test showing the context of what happened before the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM % previous comments (to get linter passing)
Will address the edits. I think adding the Fixes line in a comment works with github too fwiw. |
const net = require('net'); | ||
const server = net.createServer(); | ||
|
||
/* This test was based on an error raised by Haraka. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment is good 👍
Style nit: line comments (//
) are prefered.
And replace See:
with Ref:
'use strict'; | ||
|
||
const common = require('../common'); | ||
const assert = require('assert'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused assert
will fail linter.
CI: https://ci.nodejs.org/job/node-test-commit/10779/ not ok 3 - /usr/home/iojs/build/workspace/node-test-linter/test/async-hooks/test-get-connections.js
---
message: '''assert'' is assigned a value but never used.'
severity: error
data:
line: 4
column: 7
ruleId: no-unused-vars
messages:
- message: Trailing spaces not allowed.
severity: error
data:
line: 10
column: 1
ruleId: no-trailing-spaces
... |
I guess this is the kind of change needed for |
@@ -0,0 +1,11 @@ | |||
'use strict'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, please rename the file to test-net-get-connections.js
.
CI: https://ci.nodejs.org/job/node-test-pull-request/8942/ @baudehlo will you rename the file and add |
Just moved house and have no internet until Friday. So could you do it?
… On Jul 3, 2017, at 4:28 AM, Andreas Madsen ***@***.***> wrote:
CI: https://ci.nodejs.org/job/node-test-pull-request/8942/
@baudehlo will you rename the file. If not, I can do it myself.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
If the .listen() hasn't been called on the server, there is no handle object. In this case use null as the triggerAsyncId. Fixes: nodejs#13548
a968e81
to
6ccf034
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
landed in aa8655a |
I think it should have been |
@tniessen sorry about that. |
If the .listen() hasn't been called on the server, there is no handle object. In this case use null as the triggerAsyncId. Fixes: #13548 PR-URL: #13938 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
If the .listen() hasn't been called on the server, there is no handle object. In this case use null as the triggerAsyncId. Fixes: #13548 PR-URL: #13938 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
If the .listen() hasn't been called on the server, there is no handle object. In this case use null as the triggerAsyncId. Fixes: #13548 PR-URL: #13938 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
async-hooks, net