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

src: check whether inspector is doing io #13504

Merged
merged 1 commit into from
Jun 9, 2017

Conversation

sam-github
Copy link
Contributor

@sam-github sam-github commented Jun 6, 2017

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), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

src,inspector

@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Jun 6, 2017
@mscdex mscdex added the inspector Issues and PRs related to the V8 inspector protocol label Jun 6, 2017
@sam-github sam-github force-pushed the check-is-listening branch from ef98c6c to 29c4083 Compare June 6, 2017 21:59
@sam-github
Copy link
Contributor Author

@@ -46,3 +46,9 @@ test('--inspect=localhost:0');
test('--inspect-brk=0');
test('--inspect-brk=127.0.0.1:0');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eugeneo can we have some of these in #13478?

Copy link
Contributor

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) {
Copy link
Contributor

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 = ''

@sam-github
Copy link
Contributor Author

@refack Thanks for your suggestion, it was a good one.

@sam-github
Copy link
Contributor Author

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())
Copy link
Member

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...

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

@sam-github sam-github force-pushed the check-is-listening branch from a5dadff to b5ee5a2 Compare June 8, 2017 21:53
@sam-github
Copy link
Contributor Author

I changed the C++, so ci again: https://ci.nodejs.org/job/node-test-pull-request/8565/

@sam-github
Copy link
Contributor Author

OS X failed on

not ok 174 async-hooks/test-callback-error

@addaleax (in the absence of an at-nodejs/async-hooks)

AIX failed on

not ok 13 async-hooks/test-fseventwrap

@gireeshpunathil would you know anything about that?

Neither look related.

@addaleax
Copy link
Member

addaleax commented Jun 9, 2017

OS X failed on

not ok 174 async-hooks/test-callback-error

@addaleax (in the absence of an at-nodejs/async-hooks)

we do have @nodejs/async_hooks ;) I don’t really know how that test would be flaky.

@gibfahn
Copy link
Member

gibfahn commented Jun 9, 2017

not ok 13 async-hooks/test-fseventwrap

#13577 was just raised, so I believe you're okay there.

@sam-github
Copy link
Contributor Author

ci: https://ci.nodejs.org/job/node-test-pull-request/8578/ to see if the async hooks test always fails

@gibfahn
Copy link
Member

gibfahn commented Jun 9, 2017

not ok 174 async-hooks/test-callback-error

1000 runs on my machine (macOS sierra) with no failures, I think this is good to go.

@AndreasMadsen
Copy link
Member

I don’t really know how that test would be flaky.

It is a real mystery. See: #13527

@sam-github
Copy link
Contributor Author

OK, everything passed this time except for

not ok 1432 inspector/test-inspector-port-zero-cluster # TODO : Fix flaky test

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]>
@sam-github sam-github force-pushed the check-is-listening branch from b5ee5a2 to c4a61b3 Compare June 9, 2017 16:11
@sam-github sam-github merged commit c4a61b3 into nodejs:master Jun 9, 2017
@sam-github sam-github deleted the check-is-listening branch June 9, 2017 16:13
@gibfahn
Copy link
Member

gibfahn commented Jun 9, 2017

not ok 1432 inspector/test-inspector-port-zero-cluster # TODO : Fix flaky test

Should really have fixed that flaky test before landing this @sam-github 😉

@refack
Copy link
Contributor

refack commented Jun 9, 2017

not ok 174 async-hooks/test-callback-error

I don’t really know how that test would be flaky.

It is a real mystery. See: #13527

It just is 🤷‍♂️ (probably the process.abort taking too long)
#13559

addaleax pushed a commit that referenced this pull request Jun 10, 2017
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]>
@addaleax addaleax mentioned this pull request Jun 10, 2017
@gibfahn gibfahn mentioned this pull request Jun 15, 2017
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. inspector Issues and PRs related to the V8 inspector protocol
Projects
None yet
Development

Successfully merging this pull request may close these issues.

inspector-port=0 edge case crash