-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
src: check whether inspector is doing io #13504
Conversation
ef98c6c
to
29c4083
Compare
@@ -46,3 +46,9 @@ test('--inspect=localhost:0'); | |||
test('--inspect-brk=0'); | |||
test('--inspect-brk=127.0.0.1:0'); |
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.
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.
I added some tests there
@@ -7,7 +7,7 @@ const assert = require('assert'); | |||
const { URL } = require('url'); | |||
const { spawn } = require('child_process'); | |||
|
|||
function test(arg) { | |||
function test(arg, expected) { |
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.
why not default arg port = ''
@refack Thanks for your suggestion, it was a good one. |
src/node.cc
Outdated
@@ -3059,7 +3059,7 @@ static void DebugPortGetter(Local<Name> property, | |||
#if HAVE_INSPECTOR | |||
if (port == 0) { | |||
Environment* env = Environment::GetCurrent(info); | |||
if (env->inspector_agent()->IsStarted()) | |||
if (env->inspector_agent()->io()) |
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.
DRY: if (auto io = env->inspector_agent()->io()) port = io->port();
?
Should it check io->IsStarted()
? The inspector has a venerable multitude of IsStarted methods...
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.
No. IsStarted()
should be called IsInitialized()
, and it always happens if the Agent was constructed, unless I very much misremember. I'll check again, but I'm pretty sure. And I agree, the word "start" in method names is a bit overused in node's c++ source.
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.
yes, IsStarted()
means its newed a NodeInspectorClient client_
, its the io_
that means its listening on a port.
a5dadff
to
b5ee5a2
Compare
I changed the C++, so ci again: https://ci.nodejs.org/job/node-test-pull-request/8565/ |
OS X failed on
@addaleax (in the absence of an at-nodejs/async-hooks) AIX failed on
@gireeshpunathil would you know anything about that? Neither look related. |
we do have @nodejs/async_hooks ;) I don’t really know how that test would be flaky. |
#13577 was just raised, so I believe you're okay there. |
ci: https://ci.nodejs.org/job/node-test-pull-request/8578/ to see if the async hooks test always fails |
1000 runs on my machine (macOS sierra) with no failures, I think this is good to go. |
It is a real mystery. See: #13527 |
OK, everything passed this time except for
on centos: https://ci.nodejs.org/job/node-test-commit-linux/10482/nodes=centos7-64/ |
Inspector start means that it exists, but doesn't mean it is listening on a port, that only happens if it is doing I/O (i.e. has an io object). PR-URL: nodejs#13504 Fixes: nodejs#13499 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
b5ee5a2
to
c4a61b3
Compare
Should really have fixed that flaky test before landing this @sam-github 😉 |
Inspector start means that it exists, but doesn't mean it is listening on a port, that only happens if it is doing I/O (i.e. has an io object). PR-URL: #13504 Fixes: #13499 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Inspector start means that it exists, but doesn't mean it is listening
on a port, that only happens if it is doing I/O (i.e. has an io object).
Fixes: #13499
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
src,inspector