Fix bug in ETW trace code for AcquiredAppLock#292
Merged
Conversation
AnatoliB
approved these changes
Sep 17, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem Description
During an incident investigation, we saw the following error message logged by the ETW provider:
Impact
This error does not cause any exceptions. It just produces a logging error and prevents us from seeing any
AcquiredAppLockevents in App Service telemetry. The log should still get captured correctly in Application Insights, however, since that does not depend on the ETW provider.Root Cause and Fix
Looking at the code, the problem seemed to be that we were passing a
2to WriteEventCore when we needed to be passing a4. Rather than fixing this directly, I decided we should just not useWriteEventCore(which is unsafe) and instead just useWriteEvent, which is safer and more consistent with our other logs.As an aside
WriteEventCoreis useful as a performance optimization. However, this particular log event is written infrequently and therefore doesn't really benefit from a slightly more optimal code path.