diff options
author | Anna Henningsen <anna@addaleax.net> | 2018-10-20 11:51:29 +0200 |
---|---|---|
committer | Matheus Marchini <mat@mmarchini.me> | 2018-10-24 11:20:35 -0300 |
commit | 5d80ae3acdd812651b3b193cd31e0b81c214b50e (patch) | |
tree | efb0548ce0f26174dee13feeadab072c2c9461e5 /src/inspector | |
parent | 036fbdb63d603a64bd8562ec9331dfb7a5c5075c (diff) | |
download | android-node-v8-5d80ae3acdd812651b3b193cd31e0b81c214b50e.tar.gz android-node-v8-5d80ae3acdd812651b3b193cd31e0b81c214b50e.tar.bz2 android-node-v8-5d80ae3acdd812651b3b193cd31e0b81c214b50e.zip |
trace_events: forbid tracing modifications from worker threads
Forbid modifying tracing state from worker threads, either
through the built-in module or inspector sessions, since
the main thread owns all global state, and at least
the `async_hooks` integration is definitely not thread
safe in its current state.
PR-URL: https://github.com/nodejs/node/pull/23781
Fixes: https://github.com/nodejs/node/issues/22767
Refs: https://github.com/nodejs/node/issues/22513
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Matheus Marchini <mat@mmarchini.me>
Diffstat (limited to 'src/inspector')
-rw-r--r-- | src/inspector/tracing_agent.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/inspector/tracing_agent.cc b/src/inspector/tracing_agent.cc index 1ad67d9b9e..64bf7457d9 100644 --- a/src/inspector/tracing_agent.cc +++ b/src/inspector/tracing_agent.cc @@ -65,6 +65,10 @@ DispatchResponse TracingAgent::start( return DispatchResponse::Error( "Call NodeTracing::end to stop tracing before updating the config"); } + if (!env_->is_main_thread()) { + return DispatchResponse::Error( + "Tracing properties can only be changed through main thread sessions"); + } std::set<std::string> categories_set; protocol::Array<std::string>* categories = |