[release/8.0-staging] Fix AV in HttpTelemetry.WriteEvent #99607
Merged
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.
Backport of #99606 to release/8.0-staging
Fixes #99603
/cc @MihaZupan
Customer Impact
Reported by customer in #99603 and microsoft/reverse-proxy#2374.
When an app has telemetry turned on, it can lead to random crashes or random data being put into telemetry.
The crashes can happen multiple times a day even at very low loads (4 requests per second) - see customer report microsoft/reverse-proxy#2374.
HttpClient is passing pointers to unpinned string data to
EventSource
methods.If a garbage collection occurs before EventSource can make a copy, we may read the wrong data or crash the process due to an access violation.
Regression
Yes - introduced in 8.0 preview 7 in PR #88853.
Testing
Verified on consistent repro (using artificially increased delay before the call to
EventSource
).Risk
Very low.
The change is trivially verifiable via code review - moving a call 2 lines up so that it is inside the
fixed
scope instead of just after it.