Skip to content

Conversation

eugeneo
Copy link
Contributor

@eugeneo eugeneo commented Feb 16, 2017

This pull request switches the signal handler to start inspector socket
server instead of the legacy V8 debug protocol.

Fixes: #8464

CC: @ofrobots

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. c++ Issues and PRs that require attention from people who are familiar with C++. dont-land-on-v4.x inspector Issues and PRs related to the V8 inspector protocol labels Feb 16, 2017
@eugeneo
Copy link
Contributor Author

eugeneo commented Feb 16, 2017

Ref: nodejs/diagnostics#67

@eugeneo
Copy link
Contributor Author

eugeneo commented Feb 17, 2017

CI: https://ci.nodejs.org/job/node-test-pull-request/6457/

ARM failures are parallel/test-dgram-address that does not seem to be influenced by this change.

@ofrobots
Copy link
Contributor

/cc @nodejs/diagnostics @jkrems

@ofrobots ofrobots added the semver-major PRs that contain breaking changes and should be released in the next major version. label Feb 17, 2017
Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

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

Left a few comments … the size of the diff makes it quite difficult to tell code that was just moved around from actual changes, by the way. I don’t know if splitting into several commits would have been a possibility here, but that would make reviewing a lot easier…

Copy link
Member

Choose a reason for hiding this comment

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

Could you use a TwoByteValue for the above couple of lines?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Thanks!

Copy link
Member

Choose a reason for hiding this comment

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

Why not just value.IsEmpty() || !value->IsString()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I switched to TwoByteValue and removed this check.

Copy link
Member

Choose a reason for hiding this comment

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

Is there any reason why this can’t be const v8_inspector::StringView&?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Member

Choose a reason for hiding this comment

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

(ditto for const v8_inspector::StringView&)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Member

Choose a reason for hiding this comment

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

nit: I’m tempted to say this might better be called TransportAndIo. 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right... :) Thanks, I fixed it!

@eugeneo
Copy link
Contributor Author

eugeneo commented Feb 21, 2017

CI: https://ci.nodejs.org/job/node-test-pull-request/6527/

I do not see ARM failures through the Hudson - I think GitHub integration might be glitchy.

@jkrems
Copy link
Contributor

jkrems commented Mar 16, 2017

Tried this change against node-inspect and it worked as expected.

@jasnell
Copy link
Member

jasnell commented Mar 22, 2017

What's the status on this?

@eugeneo
Copy link
Contributor Author

eugeneo commented Mar 22, 2017

@jasnell I am not sure. Code-wise it is ready for the review. A decision needs to be made when the old debugger stops handling the signal - is this something that needs to be discussed by @nodejs/diagnostics?

@jkrems
Copy link
Contributor

jkrems commented Mar 22, 2017

@joshgav Can we pull this into tomorrow's meeting? I think it boils down to a unified "master plan" for doing the switch and when to land what and where.

@joshgav joshgav added the diag-agenda Issues and PRs to discuss during the meetings of the diagnostics working group. label Mar 22, 2017
@joshgav
Copy link
Contributor

joshgav commented Mar 22, 2017

@jkrems sure, just added label.

@eugeneo
Copy link
Contributor Author

eugeneo commented Mar 22, 2017

@jkrems, @joshgav - how can I join the meeting? I tried looking through the https://github.com/nodejs/diagnostics but did not find details about the upcoming meeting.

@jkrems
Copy link
Contributor

jkrems commented Mar 22, 2017

@eugeneo This is the meta issue for the meeting: nodejs/diagnostics#89

Copy link
Member

@bnoordhuis bnoordhuis left a comment

Choose a reason for hiding this comment

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

Mea culpa, looks like I reviewed this back in February but forgot to submit the comments. Re-reviewed; needs a rebase but the conflicts look minor.

Copy link
Member

Choose a reason for hiding this comment

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

Can you line up the arguments?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

Choose a reason for hiding this comment

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

Can you write this as CHECK_NE(channel, nullptr)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

Choose a reason for hiding this comment

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

Likewise but with CHECK_EQ. I'll stop pointing it out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

Choose a reason for hiding this comment

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

Prefer channel_ == nullptr over bool coercion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

Choose a reason for hiding this comment

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

Likewise. I'll stop pointing it out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

Choose a reason for hiding this comment

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

Can you explain why you sometimes CHECK(impl->client()) and sometimes not?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

Choose a reason for hiding this comment

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

Unused macro?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

Copy link
Member

Choose a reason for hiding this comment

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

static_cast?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

Choose a reason for hiding this comment

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

Can you CHECK_EQ(0, uv_loop_close(&loop))? I'm pretty sure this won't work on account of the closing handle.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed the code to spin until the callback is called.

Copy link
Member

Choose a reason for hiding this comment

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

Can you make this an if statement for legibility? You could also simplify it to this:

if (port < 0) {
  port = default_debugger_port;
#if HAVE_INSPECTOR
  if (inspector_enabled_)
    port = default_inspector_port;
#endif  // HAVE_INSPECTOR
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@eugeneo
Copy link
Contributor Author

eugeneo commented Mar 29, 2017

Thank you for the review. Please take another look.

@eugeneo
Copy link
Contributor Author

eugeneo commented Mar 31, 2017

I did a rebase to account for the latest changes. Please review.

@jkrems
Copy link
Contributor

jkrems commented Apr 3, 2017

Looks like there's one stray lint error:

src/inspector_io.h:119:  Lines should be <= 80 characters long  [whitespace/line_length] [2]

@jkrems jkrems mentioned this pull request Apr 3, 2017
4 tasks
@eugeneo
Copy link
Contributor Author

eugeneo commented Apr 3, 2017

@jkrems thanks for pointing that out, I fixed it.

@eugeneo
Copy link
Contributor Author

eugeneo commented Apr 3, 2017

Copy link
Member

@bnoordhuis bnoordhuis left a comment

Choose a reason for hiding this comment

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

LGTM sans some final comments. Have you checked if ./configure --without-inspector still builds?

Copy link
Member

Choose a reason for hiding this comment

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

Out of curiosity, what is the purpose of this destructor?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

Copy link
Member

Choose a reason for hiding this comment

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

Four space indent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

Choose a reason for hiding this comment

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

You could use FIXED_ONE_BYTE_STRING here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, did search/replace for all invocations

Copy link
Member

Choose a reason for hiding this comment

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

Is there a point to creating the TryCatch when it just rethrows the exception?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

Copy link
Member

Choose a reason for hiding this comment

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

You could use FIXED_ONE_BYTE_STRING here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Member

Choose a reason for hiding this comment

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

platform_ != nullptr?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

Choose a reason for hiding this comment

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

Not wrong but you could also io_thread_req_() in the initializer list.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

Choose a reason for hiding this comment

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

CHECK_EQ

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

Choose a reason for hiding this comment

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

CHECK_NE

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

src/node.cc Outdated
Copy link
Member

Choose a reason for hiding this comment

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

The change suggests it's not just about the compiler?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed outdated comment.

@eugeneo
Copy link
Contributor Author

eugeneo commented Apr 4, 2017

@bnoordhuis I moved the _debugProcess code back to node.cc so the node built with --without-inspector would still be able to send signal/do the weird Windows stuff to another Node instance. What do you think?

@bnoordhuis
Copy link
Member

@eugeneo Did you forget to push? I still see RegisterDebugSignalHandler() and friends in inspector_agent.cc, not node.cc.

(Happy to hear I'm not the only one who thinks the Windows code is weird. I'm not even sure why it works.)

@eugeneo
Copy link
Contributor Author

eugeneo commented Apr 4, 2017

Signal handler remains there, it is only the code that sends the signal that was moved back. (I see CI failures, looking into them)

@eugeneo
Copy link
Contributor Author

eugeneo commented Apr 5, 2017

@eugeneo
Copy link
Contributor Author

eugeneo commented Apr 5, 2017

CI: https://ci.nodejs.org/job/node-test-pull-request/7219/ - OS X is passing, even though its status is not properly reported.

@eugeneo eugeneo closed this Apr 6, 2017
@eugeneo eugeneo deleted the inspector-signal branch April 6, 2017 16:12
@eugeneo eugeneo merged commit 7599b0e into nodejs:master Apr 6, 2017
@eugeneo
Copy link
Contributor Author

eugeneo commented Apr 6, 2017

Landed as 7599b0e

@addaleax addaleax removed the diag-agenda Issues and PRs to discuss during the meetings of the diagnostics working group. label May 10, 2017
@jasnell jasnell mentioned this pull request May 11, 2017
@refack refack mentioned this pull request Jun 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. c++ Issues and PRs that require attention from people who are familiar with C++. inspector Issues and PRs related to the V8 inspector protocol semver-major PRs that contain breaking changes and should be released in the next major version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants