Skip to content

tracing: refactor tracing state ownership - #23781

Closed
addaleax wants to merge 3 commits into
nodejs:masterfrom
addaleax:env-tracing-writer
Closed

tracing: refactor tracing state ownership#23781
addaleax wants to merge 3 commits into
nodejs:masterfrom
addaleax:env-tracing-writer

Conversation

@addaleax

Copy link
Copy Markdown
Member
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-botnodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. labels Oct 20, 2018
@richardlau

Copy link
Copy Markdown
Member

Does the second commit need tests?

Comment threadlib/trace_events.js Outdated

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Done!

@refackrefack left a comment

Copy link
Copy Markdown
Contributor

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.

Comment threadsrc/env.cc Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
// callback is callback from whichever thread calls `StartTracing()` or
// callback is called from whichever thread calls `StartTracing()` or

or invoked or called back

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Done!

Comment threadsrc/env.cc Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
trace_state_observer_.reset(newTrackingTraceStateObserver(this));
trace_state_observer_ = std::make_unique<TrackingTraceStateObserver>(this);

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Done!

Comment threadsrc/env.cc Outdated
Comment threadsrc/env.cc Outdated
Comment threadsrc/inspector/tracing_agent.cc Outdated
Comment threadsrc/node_worker.cc Outdated
Comment threadsrc/node.cc Outdated
Comment threadsrc/node_internals.h Outdated
As per the conversation in nodejs#22513,
this is essentially global, and adding this on the Environment
is generally just confusing.
Refs: nodejs#22513Fixes: 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.
@addaleax

Copy link
Copy Markdown
MemberAuthor

@mmarchinimmarchini added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Oct 23, 2018
@addaleax

Copy link
Copy Markdown
MemberAuthor

@mmarchini

Copy link
Copy Markdown
Contributor

Landed in d568b53...5d80ae3

mmarchini pushed a commit that referenced this pull request Oct 24, 2018
As per the conversation in #22513,
this is essentially global, and adding this on the Environment
is generally just confusing.
Refs: #22513Fixes: #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>
mmarchini pushed a commit that referenced this pull request Oct 24, 2018
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: #23781Fixes: #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>
@addaleax
addaleax deleted the env-tracing-writer branch October 24, 2018 17:56
targos pushed a commit that referenced this pull request Oct 27, 2018
As per the conversation in #22513,
this is essentially global, and adding this on the Environment
is generally just confusing.
Refs: #22513Fixes: #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>
targos pushed a commit that referenced this pull request Oct 27, 2018
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: #23781Fixes: #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>
@targostargos mentioned this pull request Oct 27, 2018
@targos

Copy link
Copy Markdown
Member

Marking dont-land-on-v11.x until nodejs/build#1542 is fixed

@targostargos mentioned this pull request Nov 1, 2018
2 tasks
targos pushed a commit that referenced this pull request Nov 18, 2018
As per the conversation in #22513,
this is essentially global, and adding this on the Environment
is generally just confusing.
Refs: #22513Fixes: #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>
targos pushed a commit that referenced this pull request Nov 18, 2018
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: #23781Fixes: #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>
rvagg pushed a commit that referenced this pull request Nov 28, 2018
As per the conversation in #22513,
this is essentially global, and adding this on the Environment
is generally just confusing.
Refs: #22513Fixes: #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>
rvagg pushed a commit that referenced this pull request Nov 28, 2018
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: #23781Fixes: #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>
@BridgeARBridgeAR mentioned this pull request Dec 5, 2018
4 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.c++Issues and PRs that require attention from people who are familiar with C++.lib / srcIssues and PRs related to general changes in the lib or src directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@addaleax@nodejs-github-bot@richardlau@mmarchini@targos@refack@jasnell@codebytere