Chromium Code Reviews
DescriptionFix a crash in the event tracing shutdown path
This CL fixes a crash that could happen when JSON event tracing is
shutting down. The cause of the crash was the fact that the logger
thread function was returning 'true', causing the platform thread to run
it repeatedly even though that wasn't the intention.
Usually the EventLogger::Stop() function would set the event requesting
the logging thread to clean up and close the file, and then immediately
call PlatformThread::Stop() which would stop the outer loop. The Log()
function would only run once and everything behaves as expected.
However, if a context switch happens between the shutdown_event_.Set()
and logging_thread_.Stop() calls in EventLogger::Stop(), the logger
thread function would close the file and exit the Log() method, while
PlatformThread will rerun it again. So the Log() function runs twice,
and the second time output_file_ is NULL which either causes the DCHECK
to fail (in debug builds) or the fprintf() to crash with SIGSEGV (in
release builds).
The fix simply changes the return value of the thread function to false
so it never runs twice.
R=pthatcher@webrtc.org
Committed: https://crrev.com/843b6f503f151753842d447b2d2c33ca548e01aa
Cr-Commit-Position: refs/heads/master@{#13510}
Patch Set 1 #
Messages
Total messages: 12 (6 generated)
|
|||||||||||||||||||