Skip to content

need to get the chrome tracing lock when flushing the trace file #422

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

Merged
merged 1 commit into from
May 30, 2025

Conversation

bashbaug
Copy link
Contributor

Description of Changes

If one thread is writing to the chrome trace file while another thread flushes the file then the file may be corrupted. So, grab the chrome tracing lock when flushing the file, even if there are no chrome tracing records.

Testing Done

Tested with a heavily multi-threaded application that very occasionally generated a corrupted file before this change, but never after this change.

@bashbaug bashbaug requested a review from Copilot May 30, 2025 21:22
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ensures that the chrome tracing lock is acquired during file flushes to prevent corruption when multiple threads are involved.

  • Acquires the chrome tracing lock at the start of flush() even if the record buffer is empty.
  • Removes the redundant lock acquisition previously present within the if block.

@bashbaug bashbaug merged commit 8c6853a into intel:main May 30, 2025
8 checks passed
@bashbaug bashbaug deleted the chrome-tracing-flush-fix branch May 30, 2025 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant