Skip to content

Commit

Permalink
trace_events: avoid flusing uninitialized traces
Browse files Browse the repository at this point in the history
PR-URL: #22812
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
  • Loading branch information
ofrobots authored and targos committed Sep 20, 2018
1 parent 967fbeb commit aa05c8b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/tracing/node_trace_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
// Another thread may have added a trace that is yet to be
// initialized. Skip such traces.
// https://github.com/nodejs/node/issues/21038.
if (trace_event->name()) {
agent_->AppendTraceEvent(trace_event);
}
}
}
total_chunks_ = 0;
Expand Down

0 comments on commit aa05c8b

Please sign in to comment.