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

test,inspector: add heap allocation tracker test #26089

Closed

Conversation

addaleax
Copy link
Member

This provides coverage for the InspectorTimer instances
created as part of heap allocation tracking.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

@addaleax addaleax requested a review from eugeneo February 14, 2019 00:25
@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Feb 14, 2019
This provides coverage for the `InspectorTimer` instances
created as part of heap allocation tracking.
@addaleax addaleax force-pushed the inspector-heap-alloc-track-test branch from 9362d0d to 9397b12 Compare February 14, 2019 00:26
@addaleax addaleax added the inspector Issues and PRs related to the V8 inspector protocol label Feb 14, 2019
@addaleax
Copy link
Member Author

// TODO(addaleax): Using `{ reportProgress: true }` crashes the process
// because the progress indication event would mean calling into JS while
// a heap snapshot is being taken, which is forbidden.
// What can we do about that?
Copy link
Member Author

Choose a reason for hiding this comment

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

Btw, @eugeneo @nodejs/v8 any ideas for what to do about this?

@addaleax
Copy link
Member Author

addaleax commented Feb 15, 2019

I’ll try to look into the Windows failures (unless they are the same as what @joyeecheung saw in #26006 and she already has something figured out?)

Edit: Possible diff for addressing this:
diff --git a/src/inspector/main_thread_interface.cc b/src/inspector/main_thread_interface.cc
index 1bcf65134f..25b6270e41 100644
--- a/src/inspector/main_thread_interface.cc
+++ b/src/inspector/main_thread_interface.cc
@@ -224,11 +224,6 @@ MainThreadInterface::MainThreadInterface(Agent* agent, uv_loop_t* loop,
                                          v8::Platform* platform)
                                          : agent_(agent), isolate_(isolate),
                                            platform_(platform) {
-  main_thread_request_.reset(new AsyncAndInterface(uv_async_t(), this));
-  CHECK_EQ(0, uv_async_init(loop, &main_thread_request_->first,
-                            DispatchMessagesAsyncCallback));
-  // Inspector uv_async_t should not prevent main loop shutdown.
-  uv_unref(reinterpret_cast<uv_handle_t*>(&main_thread_request_->first));
 }

 MainThreadInterface::~MainThreadInterface() {
@@ -253,7 +248,6 @@ void MainThreadInterface::Post(std::unique_ptr<Request> request) {
   bool needs_notify = requests_.empty();
   requests_.push_back(std::move(request));
   if (needs_notify) {
-    CHECK_EQ(0, uv_async_send(&main_thread_request_->first));
     if (isolate_ != nullptr && platform_ != nullptr) {
       std::shared_ptr<v8::TaskRunner> taskrunner =
         platform_->GetForegroundTaskRunner(isolate_);
diff --git a/src/inspector/main_thread_interface.h b/src/inspector/main_thread_interface.h
index a7d9f8a3c9..1c644144cc 100644
--- a/src/inspector/main_thread_interface.h
+++ b/src/inspector/main_thread_interface.h
@@ -105,7 +105,6 @@ class MainThreadInterface {
   Agent* const agent_;
   v8::Isolate* const isolate_;
   v8::Platform* const platform_;
-  DeleteFnPtr<AsyncAndInterface, CloseAsync> main_thread_request_;
   std::shared_ptr<MainThreadHandle> handle_;
   std::unordered_map<int, std::unique_ptr<Deletable>> managed_objects_;
 };
diff --git a/src/node_worker.cc b/src/node_worker.cc
index f38b187c18..feda1d7210 100644
--- a/src/node_worker.cc
+++ b/src/node_worker.cc
@@ -150,7 +150,8 @@ class WorkerThreadData {

     isolate->Dispose();

-    // Need to run the loop one more time to close the platform's uv_async_t
+    // Need to run the loop twice to close the platform's uv_async_t
+    uv_run(&loop_, UV_RUN_ONCE);
     uv_run(&loop_, UV_RUN_ONCE);

     CheckedUvLoopClose(&loop_);

addaleax added a commit to addaleax/node that referenced this pull request Feb 15, 2019
This is redundant to the platform notification mechanism, and
the handle may not be cleaned up util we attempt to close the loop.

Refs: nodejs#26089
Refs: nodejs#26006
addaleax added a commit to addaleax/node that referenced this pull request Feb 15, 2019
On Windows, the Platform’s `uv_async_t` may need two iterations
before closing when it was previously in use.

Refs: nodejs#26089
Refs: nodejs#26006
@addaleax addaleax added blocked PRs that are blocked by other issues or PRs. and removed blocked PRs that are blocked by other issues or PRs. labels Feb 16, 2019
addaleax added a commit that referenced this pull request Feb 17, 2019
This is redundant to the platform notification mechanism, and
the handle may not be cleaned up util we attempt to close the loop.

Refs: #26089
Refs: #26006

PR-URL: #26137
Reviewed-By: Eugene Ostroukhov <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
addaleax added a commit that referenced this pull request Feb 17, 2019
On Windows, the Platform’s `uv_async_t` may need two iterations
before closing when it was previously in use.

Refs: #26089
Refs: #26006

PR-URL: #26138
Reviewed-By: Eugene Ostroukhov <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
@addaleax
Copy link
Member Author

addaleax added a commit that referenced this pull request Feb 18, 2019
This is redundant to the platform notification mechanism, and
the handle may not be cleaned up util we attempt to close the loop.

Refs: #26089
Refs: #26006

PR-URL: #26137
Reviewed-By: Eugene Ostroukhov <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
addaleax added a commit that referenced this pull request Feb 18, 2019
On Windows, the Platform’s `uv_async_t` may need two iterations
before closing when it was previously in use.

Refs: #26089
Refs: #26006

PR-URL: #26138
Reviewed-By: Eugene Ostroukhov <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
@addaleax
Copy link
Member Author

@addaleax addaleax added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Feb 19, 2019
@addaleax
Copy link
Member Author

Landed in cfcbfc0

@addaleax addaleax closed this Feb 20, 2019
@addaleax addaleax deleted the inspector-heap-alloc-track-test branch February 20, 2019 15:59
addaleax added a commit that referenced this pull request Feb 20, 2019
This provides coverage for the `InspectorTimer` instances
created as part of heap allocation tracking.

PR-URL: #26089
Reviewed-By: Eugene Ostroukhov <[email protected]>
Reviewed-By: James M Snell <[email protected]>
addaleax added a commit that referenced this pull request Feb 21, 2019
This provides coverage for the `InspectorTimer` instances
created as part of heap allocation tracking.

PR-URL: #26089
Reviewed-By: Eugene Ostroukhov <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@BridgeAR BridgeAR mentioned this pull request Feb 26, 2019
rvagg pushed a commit that referenced this pull request Feb 28, 2019
This is redundant to the platform notification mechanism, and
the handle may not be cleaned up util we attempt to close the loop.

Refs: #26089
Refs: #26006

PR-URL: #26137
Reviewed-By: Eugene Ostroukhov <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
rvagg pushed a commit that referenced this pull request Feb 28, 2019
On Windows, the Platform’s `uv_async_t` may need two iterations
before closing when it was previously in use.

Refs: #26089
Refs: #26006

PR-URL: #26138
Reviewed-By: Eugene Ostroukhov <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
rvagg pushed a commit that referenced this pull request Feb 28, 2019
This provides coverage for the `InspectorTimer` instances
created as part of heap allocation tracking.

PR-URL: #26089
Reviewed-By: Eugene Ostroukhov <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. inspector Issues and PRs related to the V8 inspector protocol test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants