diff options
author | Anna Henningsen <anna@addaleax.net> | 2018-07-27 19:16:35 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-08-01 18:17:06 +0300 |
commit | 281e5a3ceec1a0463d4572a048cff13ea4ade57f (patch) | |
tree | 6c50d46eac0566a1dca67f7409b35420f61e07f5 /src/tracing | |
parent | 5e83a2abd0eccfb9b7200605e8371eb301dec452 (diff) |
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>
Diffstat (limited to 'src/tracing')
-rw-r--r-- | src/tracing/agent.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/tracing/agent.cc b/src/tracing/agent.cc index 9b435b56d2c..5a4d637bda0 100644 --- a/src/tracing/agent.cc +++ b/src/tracing/agent.cc @@ -59,6 +59,7 @@ Agent::Agent() { Agent* agent = ContainerOf(&Agent::initialize_writer_async_, async); agent->InitializeWritersOnThread(); }), 0); + uv_unref(reinterpret_cast<uv_handle_t*>(&initialize_writer_async_)); } void Agent::InitializeWritersOnThread() { @@ -72,6 +73,11 @@ void Agent::InitializeWritersOnThread() { } Agent::~Agent() { + categories_.clear(); + writers_.clear(); + + StopTracing(); + uv_close(reinterpret_cast<uv_handle_t*>(&initialize_writer_async_), nullptr); uv_run(&tracing_loop_, UV_RUN_ONCE); CheckedUvLoopClose(&tracing_loop_); |