inspector: split main thread interface from transport#21182
inspector: split main thread interface from transport#21182eugeneo wants to merge 1 commit intonodejs:masterfrom eugeneo:asyncs_io_prepare_worker
Conversation
src/signal_wrap.cc
Outdated
There was a problem hiding this comment.
Here I am unsure about the semantics. Do we want this warning printed out when Inspector is installed on the isolate (which is currently "always", because of JS API and _debugProcess support) or when the WS server is running.
src/inspector_agent.cc
Outdated
There was a problem hiding this comment.
My understanding is that make_shared should be fine as it is a part of C++11 (make_unique was introduced shortly after C++11)
src/inspector_agent.h
Outdated
There was a problem hiding this comment.
Fixed locally, will upload when addressing future review comments.
src/inspector_io.cc
Outdated
There was a problem hiding this comment.
Looks like this is a first usage of std::weak_ptr in Node codebase. Standard seems to require it to be thread-safe. I would like to confirm with people familiar with less wide-spread platforms it is ok to use it here.
test/parallel/test-warn-sigprof.js
Outdated
There was a problem hiding this comment.
This change is because I assume handling SIGPROF should only produce the warning when the WS server is running
There was a problem hiding this comment.
Will remove this delta in next upload.
addaleax
left a comment
There was a problem hiding this comment.
Nice work! I’ll need more time to look at this in detail, but I’ll try to do it if I find that time.
node.gyp
Outdated
There was a problem hiding this comment.
These two headers don’t exist anymore, I think we want to remove them from this PR?
|
Thanks for the review. |
|
This PR needs bit more significant changes then anticipated, it is still in progress. |
|
I've uploaded a new change and this PR is now ready for review. This change addresses a race condition that caused some inspector tests to become unreliable, I will run stress tests to confirm it. |
|
CI link (all green): https://ci.nodejs.org/job/node-test-pull-request/15500/ |
|
Stress tests: https://ci.nodejs.org/job/node-stress-single-test/1926/nodes=win2016-1p-vs2017/console My understanding is that the tests were not flaky. Did I have to remove them from the flaky tests list first? |
src/inspector_io.h
Outdated
There was a problem hiding this comment.
This comment should move with class Environment.
src/inspector_io.cc
Outdated
There was a problem hiding this comment.
One more level of indentaiton.
|
I did a rebase. I was unable to reintegrate WS messages logging, it was not implemented correctly (was accessing env from the non-main thread). Is it really necessary? |
|
@addaleax can you please take a look? |
|
Another CI, previous push excluded some fixes from another workstation: https://ci.nodejs.org/job/node-test-pull-request/15772/ |
There was a problem hiding this comment.
nit: I’d use std::shared_ptr<T> object here explicitly, and std::shared_ptr<T> object_; as the member, to be clearer about how this is being used
There was a problem hiding this comment.
Done. Added some asserts to ensure resetting the pointer actually destroys the object.
There was a problem hiding this comment.
nit: This can just be an inline lambda, that makes it a bit more readable since it’s much closer to the call site then
There was a problem hiding this comment.
style nit: Leave a space between method definitions
There was a problem hiding this comment.
It might be good to add a comment explaining what “Block” means in this context (It’s not clear to me at this point)
There was a problem hiding this comment.
I renamed the class, hope now it is more clear. It is meant to keep the parts of the state that live on another thread separate.
There was a problem hiding this comment.
Can you add a comment indicating which members exactly are protected by this lock?
There was a problem hiding this comment.
Done. Also, renamed the lock.
src/inspector_agent.cc
Outdated
There was a problem hiding this comment.
const v8_inspector::StringView&?
src/inspector_io.cc
Outdated
There was a problem hiding this comment.
(tiny) style nit: put : on the next line
src/inspector_io.cc
Outdated
There was a problem hiding this comment.
Might be worth using std::deque<Message> for some struct Message { … }; instead, for readability?
src/inspector_io.cc
Outdated
There was a problem hiding this comment.
I’d personally make both of these lambdas as well, for readability
|
Thank you for the review. I addressed the comments. |
|
Investigating a test failure. |
|
Stress test for the fixed Windows failure: https://ci.nodejs.org/job/node-stress-single-test/1943/ New CI for this change: https://ci.nodejs.org/job/node-test-pull-request/15786/ |
|
100 iterations of the tests marked as flaky on Windows - https://ci.nodejs.org/job/node-stress-single-test/nodes=win2012r2-mp-vs2017/1944/ Looks like no failures, there is some weird macOS 10.10 failure, will need to investigate. |
|
I redid management for objects living on another thread. CI is green now: https://ci.nodejs.org/job/node-test-pull-request/15816/ I also run a stress test on a number of inspector flaky tests, seems like they should be fixed now. Delta with the reviewed version: 14cb71a I do not think the changes are big enough to invalidate the approvals, but I will wait a couple days in case there are any comments. |
Workers debugging will require interfacing between the "main" inspector and per-worker isolate inspectors. This is consistent with what WS interface does. This change is a refactoring change and does not change the functionality. PR-URL: #21182 Fixes: #21725 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
|
CI failure in the status bar looks weird (edit: see Eugene’s run below) |
|
CI: https://ci.nodejs.org/job/node-test-pull-request/15856/ There is one failure, when building V8 files on CentOS7. I am fairly confident this can be ignored. I will land the change. |
|
Landed in 39977db |
Workers debugging will require interfacing between the "main" inspector and per-worker isolate inspectors. This is consistent with what WS interface does. This change is a refactoring change and does not change the functionality. PR-URL: nodejs#21182 Fixes: nodejs#21725 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
After nodejs#21182, the test is no longer flaky. Since it doesn’t use a static port, moving it to parallel seems justified.
Workers debugging will require interfacing between the "main" inspector and per-worker isolate inspectors. This is consistent with what WS interface does. This change is a refactoring change and does not change the functionality. PR-URL: #21182 Fixes: #21725 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Workers debugging will require interfacing between the "main" inspector and per-worker isolate inspectors. This is consistent with what WS interface does. This change is a refactoring change and does not change the functionality. PR-URL: nodejs#21182 Fixes: nodejs#21725 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
|
Unfortunately, this change seems to have increased the failure of sequential/test-debug-prompt test on OS X 10.10 (Yosemite) in CI from about 0.01% failure to about a 24% failure. See #21724. I'm not sure if the problem lies here or in the test or is something specific to older versions of OS X. EDIT: PR to possibly fix test: #21826. |
After #21182, the test is no longer flaky. Since it doesn’t use a static port, moving it to parallel seems justified. PR-URL: #21806 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
After #21182, the test is no longer flaky. Since it doesn’t use a static port, moving it to parallel seems justified. PR-URL: #21806 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Workers debugging will require interfacing between the "main" inspector
and per-worker isolate inspectors. This is consistent with what WS
interface does. This change is a refactoring change and does not change
the functionality.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes