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

Stop using m_summary in the global globals for telemetry #2820

Merged
merged 1 commit into from
Jan 5, 2023

Conversation

florelis
Copy link
Member

@florelis florelis commented Jan 5, 2023

We were observing crashes in TelemetryTraceLogger::LogFailure() due to heap corruption. The root cause of this is that for many types of COM calls we don't have a thread local telemetry trace logger, but instead use a process global. If there are multiple simultaneous calls, there is a possibility for a race condition, specifically around writing to the TelemetryTraceLogger's m_summary.

The long term solution would be to stop using a process globals there, but that is tricky. As a band-aid to prevent these crashes, disable the use of m_summary in the process globals.

Tested by creating a local repro of the crash and verifying it didn't crash after the change. Repro'd by adding an artificial THROW_HR_MSG to force going to LogFailure() and then using the sample COM caller project to generate many simultaneous calls that would hit it.

Credit to @JohnMcPMS for figuring out the issue and the fix :)

Related to #1880

Microsoft Reviewers: Open in CodeFlow

@florelis florelis requested a review from a team as a code owner January 5, 2023 22:08
Copy link
Member

@JohnMcPMS JohnMcPMS left a comment

Choose a reason for hiding this comment

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

I only guessed at the cause, but this is definitely a potential issue. No guarantees that this fixed anything that is actually happening 😉

Copy link
Contributor

@yao-msft yao-msft left a comment

Choose a reason for hiding this comment

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

:shipit:

@florelis florelis merged commit 461ba7b into microsoft:master Jan 5, 2023
@florelis florelis deleted the telemetryGlobals branch January 5, 2023 23:12
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.

3 participants