src: clean up agent loop when exiting through destructor
Fixes: https://github.com/nodejs/node/issues/22042 PR-URL: https://github.com/nodejs/node/pull/21867 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
This commit is contained in:
parent
5e83a2abd0
commit
281e5a3cee
@ -398,10 +398,10 @@ static struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Dispose() {
|
void Dispose() {
|
||||||
|
tracing_agent_.reset(nullptr);
|
||||||
platform_->Shutdown();
|
platform_->Shutdown();
|
||||||
delete platform_;
|
delete platform_;
|
||||||
platform_ = nullptr;
|
platform_ = nullptr;
|
||||||
tracing_agent_.reset(nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrainVMTasks(Isolate* isolate) {
|
void DrainVMTasks(Isolate* isolate) {
|
||||||
|
@ -59,6 +59,7 @@ Agent::Agent() {
|
|||||||
Agent* agent = ContainerOf(&Agent::initialize_writer_async_, async);
|
Agent* agent = ContainerOf(&Agent::initialize_writer_async_, async);
|
||||||
agent->InitializeWritersOnThread();
|
agent->InitializeWritersOnThread();
|
||||||
}), 0);
|
}), 0);
|
||||||
|
uv_unref(reinterpret_cast<uv_handle_t*>(&initialize_writer_async_));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Agent::InitializeWritersOnThread() {
|
void Agent::InitializeWritersOnThread() {
|
||||||
@ -72,6 +73,11 @@ void Agent::InitializeWritersOnThread() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Agent::~Agent() {
|
Agent::~Agent() {
|
||||||
|
categories_.clear();
|
||||||
|
writers_.clear();
|
||||||
|
|
||||||
|
StopTracing();
|
||||||
|
|
||||||
uv_close(reinterpret_cast<uv_handle_t*>(&initialize_writer_async_), nullptr);
|
uv_close(reinterpret_cast<uv_handle_t*>(&initialize_writer_async_), nullptr);
|
||||||
uv_run(&tracing_loop_, UV_RUN_ONCE);
|
uv_run(&tracing_loop_, UV_RUN_ONCE);
|
||||||
CheckedUvLoopClose(&tracing_loop_);
|
CheckedUvLoopClose(&tracing_loop_);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user