Skip to content
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

tracing: Fix some race conditions #22812

Closed
wants to merge 2 commits into from
Closed

Conversation

ofrobots
Copy link
Contributor

This PR contains two commits that fix some race conditions that were causing flakiness on #21038. There may yet be more races, but this is what I got right now.

One of the commits is an upstream V8 fix. I didn't bother requesting an upstream back-port as it is not particular useful for Chrome and better to float here.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Original commit message:

    [tracing] do not add traces when disabled

    nodejs#21038

    Change-Id: Ic4c9f403b5e54a97d3170b2311dd5aab8c8357c8
    Reviewed-on: https://chromium-review.googlesource.com/1217726
    Commit-Queue: Ali Ijaz Sheikh <[email protected]>
    Reviewed-by: Yang Guo <[email protected]>
    Cr-Commit-Position: refs/heads/master@{nodejs#55809}

Refs: v8/v8@2363cdf
@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. c++ Issues and PRs that require attention from people who are familiar with C++. v8 engine Issues and PRs related to the V8 dependency. labels Sep 12, 2018
@@ -59,7 +59,13 @@ void InternalTraceBuffer::Flush(bool blocking) {
for (size_t i = 0; i < total_chunks_; ++i) {
auto& chunk = chunks_[i];
for (size_t j = 0; j < chunk->size(); ++j) {
agent_->AppendTraceEvent(chunk->GetEventAt(j));
TraceObject* trace_event = chunk->GetEventAt(j);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not auto?

Copy link
Member

@addaleax addaleax Sep 12, 2018

Choose a reason for hiding this comment

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

We tend to avoid auto, except for cases where the type is hard to spell out (e.g. STL iterator types/dependent on templating), or long and easy to infer (e.g. auto foo = new VeryLongClassName();). Using auto means spending more time writing the code, but more time reading it, and Node.js code is typically read a lot more than it is written.

Copy link
Contributor

Choose a reason for hiding this comment

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

IMHO it's time for that to change (ES.11).
Beside using the CCG to not bikeshed, for me as a reader TraceObject* is as opaque as auto, that why we have IDEs.

Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

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

I think this actually fixes a problem I've been seeing in some of the other dev work I've been doing. LGTM!

@ofrobots
Copy link
Contributor Author

Upstream change got flagged by UBSAN. I need to investigate those before this lands.

@ofrobots ofrobots added the wip Issues and PRs that are still a work in progress. label Sep 12, 2018
@ofrobots
Copy link
Contributor Author

UBSAN failures were unrelated to my change 🎉.

CI: https://ci.nodejs.org/job/node-test-pull-request/17173/

@ofrobots ofrobots removed the wip Issues and PRs that are still a work in progress. label Sep 13, 2018
@ofrobots
Copy link
Contributor Author

CI looks green. I will land this later today.

@ofrobots
Copy link
Contributor Author

ofrobots commented Sep 14, 2018

Landed as 5cccc55...90c9368.

@ofrobots ofrobots closed this Sep 14, 2018
@ofrobots ofrobots deleted the fix/21308 branch September 14, 2018 01:13
ofrobots added a commit that referenced this pull request Sep 14, 2018
Original commit message:

    [tracing] do not add traces when disabled

    #21038

    Change-Id: Ic4c9f403b5e54a97d3170b2311dd5aab8c8357c8
    Reviewed-on: https://chromium-review.googlesource.com/1217726
    Commit-Queue: Ali Ijaz Sheikh <[email protected]>
    Reviewed-by: Yang Guo <[email protected]>
    Cr-Commit-Position: refs/heads/master@{#55809}

Refs: v8/v8@2363cdf
PR-URL: #22812
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Eugene Ostroukhov <[email protected]>
ofrobots added a commit that referenced this pull request Sep 14, 2018
PR-URL: #22812
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Eugene Ostroukhov <[email protected]>
targos pushed a commit that referenced this pull request Sep 14, 2018
Original commit message:

    [tracing] do not add traces when disabled

    #21038

    Change-Id: Ic4c9f403b5e54a97d3170b2311dd5aab8c8357c8
    Reviewed-on: https://chromium-review.googlesource.com/1217726
    Commit-Queue: Ali Ijaz Sheikh <[email protected]>
    Reviewed-by: Yang Guo <[email protected]>
    Cr-Commit-Position: refs/heads/master@{#55809}

Refs: v8/v8@2363cdf
PR-URL: #22812
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Eugene Ostroukhov <[email protected]>
targos pushed a commit that referenced this pull request Sep 14, 2018
PR-URL: #22812
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Eugene Ostroukhov <[email protected]>
targos pushed a commit that referenced this pull request Sep 19, 2018
Original commit message:

    [tracing] do not add traces when disabled

    #21038

    Change-Id: Ic4c9f403b5e54a97d3170b2311dd5aab8c8357c8
    Reviewed-on: https://chromium-review.googlesource.com/1217726
    Commit-Queue: Ali Ijaz Sheikh <[email protected]>
    Reviewed-by: Yang Guo <[email protected]>
    Cr-Commit-Position: refs/heads/master@{#55809}

Refs: v8/v8@2363cdf
PR-URL: #22812
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Eugene Ostroukhov <[email protected]>
targos pushed a commit that referenced this pull request Sep 19, 2018
PR-URL: #22812
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Eugene Ostroukhov <[email protected]>
targos pushed a commit that referenced this pull request Sep 20, 2018
Original commit message:

    [tracing] do not add traces when disabled

    #21038

    Change-Id: Ic4c9f403b5e54a97d3170b2311dd5aab8c8357c8
    Reviewed-on: https://chromium-review.googlesource.com/1217726
    Commit-Queue: Ali Ijaz Sheikh <[email protected]>
    Reviewed-by: Yang Guo <[email protected]>
    Cr-Commit-Position: refs/heads/master@{#55809}

Refs: v8/v8@2363cdf
PR-URL: #22812
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Eugene Ostroukhov <[email protected]>
targos pushed a commit that referenced this pull request Sep 20, 2018
PR-URL: #22812
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Eugene Ostroukhov <[email protected]>
Trott added a commit to Trott/io.js that referenced this pull request Oct 6, 2018
Unreliability for test-trace-events-fs-sync is believed to have been
fixed. Remove flaky designation.

Ref: nodejs#22812
Ref: nodejs#21038 (comment)
Trott added a commit to Trott/io.js that referenced this pull request Oct 7, 2018
Unreliability for test-trace-events-fs-sync is believed to have been
fixed. Remove flaky designation.

Ref: nodejs#22812
Ref: nodejs#21038 (comment)

PR-URL: nodejs#22856
Refs: nodejs#22812
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Weijia Wang <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
targos pushed a commit that referenced this pull request Oct 7, 2018
Unreliability for test-trace-events-fs-sync is believed to have been
fixed. Remove flaky designation.

Ref: #22812
Ref: #21038 (comment)

PR-URL: #22856
Refs: #22812
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Weijia Wang <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
targos pushed a commit that referenced this pull request Oct 7, 2018
Unreliability for test-trace-events-fs-sync is believed to have been
fixed. Remove flaky designation.

Ref: #22812
Ref: #21038 (comment)

PR-URL: #22856
Refs: #22812
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Weijia Wang <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
jasnell pushed a commit that referenced this pull request Oct 17, 2018
Unreliability for test-trace-events-fs-sync is believed to have been
fixed. Remove flaky designation.

Ref: #22812
Ref: #21038 (comment)

PR-URL: #22856
Refs: #22812
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Weijia Wang <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. c++ Issues and PRs that require attention from people who are familiar with C++. v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants