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 TracingController cleanup #10623

Closed
wants to merge 1 commit into from

Conversation

jasongin
Copy link
Member

@jasongin jasongin commented Jan 5, 2017

This fixes an incorrect deletion of the TracingController instance,
which in some environments could cause an error about an invalid
pointer passed to free(). The TracingController instance is
actually owned by a unique_ptr member of the platform, so calling
platform::SetTracingController(nullptr) is the correct way to
delete it. But before that, the TraceBuffer must be deleted in
order for the tracing loop to exit; that is accomplished by calling
TracingController::Initialize(nullptr).

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

tracing

This fixes an incorrect deletion of the `TracingController` instance,
which in some environments could cause an error about an invalid
pointer passed to `free()`. The `TracingController` instance is
actually owned by a `unique_ptr` member of the platform, so calling
`platform::SetTracingController(nullptr)` is the correct way to
delete it. But before that, the `TraceBuffer` must be deleted in
order for the tracing loop to exit; that is accomplished by calling
`TracingController::Initialize(nullptr)`.
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. dont-land-on-v7.x labels Jan 5, 2017
@jasongin jasongin mentioned this pull request Jan 5, 2017
2 tasks
@jasongin
Copy link
Member Author

jasongin commented Jan 5, 2017

This fixes the failure reported here: #9618 (comment)

@matthewloring
Copy link

LGTM. Thank you for investigating this @jasongin

@targos
Copy link
Member

targos commented Jan 6, 2017

@kjin
Copy link
Contributor

kjin commented Jan 6, 2017

Thanks for fixing this!

@digitalinfinity
Copy link
Contributor

LGTM too

targos pushed a commit that referenced this pull request Jan 7, 2017
This fixes an incorrect deletion of the `TracingController` instance,
which in some environments could cause an error about an invalid
pointer passed to `free()`. The `TracingController` instance is
actually owned by a `unique_ptr` member of the platform, so calling
`platform::SetTracingController(nullptr)` is the correct way to
delete it. But before that, the `TraceBuffer` must be deleted in
order for the tracing loop to exit; that is accomplished by calling
`TracingController::Initialize(nullptr)`.

PR-URL: #10623
Reviewed-By: Matthew Loring <mattloring@google.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
@targos
Copy link
Member

targos commented Jan 7, 2017

Landed in 58c38c2. Thank you!

@targos targos closed this Jan 7, 2017
@mscdex mscdex added the trace_events Issues and PRs related to V8, Node.js core, and userspace code trace events. label Jan 29, 2017
@evanlucas
Copy link
Contributor

Marking don't land since it depends on #9304

targos pushed a commit to targos/node that referenced this pull request Mar 1, 2017
This fixes an incorrect deletion of the `TracingController` instance,
which in some environments could cause an error about an invalid
pointer passed to `free()`. The `TracingController` instance is
actually owned by a `unique_ptr` member of the platform, so calling
`platform::SetTracingController(nullptr)` is the correct way to
delete it. But before that, the `TraceBuffer` must be deleted in
order for the tracing loop to exit; that is accomplished by calling
`TracingController::Initialize(nullptr)`.

PR-URL: nodejs#10623
Reviewed-By: Matthew Loring <mattloring@google.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Mar 1, 2017
This fixes an incorrect deletion of the `TracingController` instance,
which in some environments could cause an error about an invalid
pointer passed to `free()`. The `TracingController` instance is
actually owned by a `unique_ptr` member of the platform, so calling
`platform::SetTracingController(nullptr)` is the correct way to
delete it. But before that, the `TraceBuffer` must be deleted in
order for the tracing loop to exit; that is accomplished by calling
`TracingController::Initialize(nullptr)`.

PR-URL: nodejs#10623
Reviewed-By: Matthew Loring <mattloring@google.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
@italoacasas italoacasas mentioned this pull request Mar 1, 2017
@jasnell
Copy link
Member

jasnell commented Mar 7, 2017

Marking as don't land on 4 and 6 given that it apparently depends on #9304.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. trace_events Issues and PRs related to V8, Node.js core, and userspace code trace events.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants