diff options
Diffstat (limited to 'src/tracing/node_trace_writer.cc')
-rw-r--r-- | src/tracing/node_trace_writer.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/tracing/node_trace_writer.cc b/src/tracing/node_trace_writer.cc index 1d06c94233..5979810668 100644 --- a/src/tracing/node_trace_writer.cc +++ b/src/tracing/node_trace_writer.cc @@ -138,8 +138,13 @@ void NodeTraceWriter::FlushPrivate() { void NodeTraceWriter::Flush(bool blocking) { Mutex::ScopedLock scoped_lock(request_mutex_); - if (!json_trace_writer_) { - return; + { + // We need to lock the mutexes here in a nested fashion; stream_mutex_ + // protects json_trace_writer_, and without request_mutex_ there might be + // a time window in which the stream state changes? + Mutex::ScopedLock stream_mutex_lock(stream_mutex_); + if (!json_trace_writer_) + return; } int request_id = ++num_write_requests_; int err = uv_async_send(&flush_signal_); |