-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
tracing: refactor tracing state ownership #23781
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
Conversation
|
Does the second commit need tests? |
lib/trace_events.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A note about this limitation should be added in tracing.md also
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
refack
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments and questions.
src/env.cc
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // callback is callback from whichever thread calls `StartTracing()` or | |
| // callback is called from whichever thread calls `StartTracing()` or |
or invoked or called back
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
src/env.cc
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| trace_state_observer_.reset(new TrackingTraceStateObserver(this)); | |
| trace_state_observer_ = std::make_unique<TrackingTraceStateObserver>(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
As per the conversation in nodejs#22513, this is essentially global, and adding this on the Environment is generally just confusing. Refs: nodejs#22513 Fixes: nodejs#22767
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.
cecac2b to
66094c3
Compare
|
Landed in d568b53...5d80ae3 |
As per the conversation in #22513, this is essentially global, and adding this on the Environment is generally just confusing. Refs: #22513 Fixes: #22767 PR-URL: #23781 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Matheus Marchini <mat@mmarchini.me>
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: #23781 Fixes: #22767 Refs: #22513 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Matheus Marchini <mat@mmarchini.me>
As per the conversation in #22513, this is essentially global, and adding this on the Environment is generally just confusing. Refs: #22513 Fixes: #22767 PR-URL: #23781 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Matheus Marchini <mat@mmarchini.me>
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: #23781 Fixes: #22767 Refs: #22513 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Matheus Marchini <mat@mmarchini.me>
|
Marking dont-land-on-v11.x until nodejs/build#1542 is fixed |
As per the conversation in #22513, this is essentially global, and adding this on the Environment is generally just confusing. Refs: #22513 Fixes: #22767 PR-URL: #23781 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Matheus Marchini <mat@mmarchini.me>
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: #23781 Fixes: #22767 Refs: #22513 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Matheus Marchini <mat@mmarchini.me>
As per the conversation in #22513, this is essentially global, and adding this on the Environment is generally just confusing. Refs: #22513 Fixes: #22767 PR-URL: #23781 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Matheus Marchini <mat@mmarchini.me>
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: #23781 Fixes: #22767 Refs: #22513 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Matheus Marchini <mat@mmarchini.me>
src: remove
Environment::tracing_agent_writer()As per the conversation in Scope of inspector/tracing agents #22513,
this is essentially global, and adding this on the Environment
is generally just confusing.
Refs: Scope of inspector/tracing agents #22513
Fixes: node::Environment::tracing_agent_writer returns nullptr in a worker #22767
tracing: 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_hooksintegration is definitely not threadsafe in its current state.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes