Fix GCStats failures on dotnet trace gc-verbose collections (#2414)#2415
Open
cincuranet wants to merge 1 commit intomicrosoft:mainfrom
Open
Fix GCStats failures on dotnet trace gc-verbose collections (#2414)#2415cincuranet wants to merge 1 commit intomicrosoft:mainfrom
cincuranet wants to merge 1 commit intomicrosoft:mainfrom
Conversation
…t#2414) Two issues prevented the GCStats report from opening for traces collected via `dotnet trace --profile gc-verbose`: 1. `PrintEventCondemnedReasonsTable` in `GcStats.cs` threw NullReferenceException because `GetCondemnedReasonRow` returns null when a TraceGC has neither PerHeapCondemnedReasons nor GlobalCondemnedReasons. Skip such events instead of adding null rows to the table. 2. `AddConcurrentPauseTime` in `TraceManagedProcess.cs` had a `Debug.Assert(_event.PauseDurationMSec == 0)` that was always wrong for BackgroundGCs: the GCStart handler intentionally pre-seeds `PauseDurationMSec = SuspendDurationMSec` for BGCs, so by the time the initial RestartEEStop fires the value is non-zero by design. The else branch's assignment then correctly replaces it with the full pause. Remove the bogus assertion. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Two issues prevented the GCStats report from opening for traces collected via
dotnet trace --profile gc-verbose:PrintEventCondemnedReasonsTableinGcStats.csthrew NullReferenceException becauseGetCondemnedReasonRowreturns null when a TraceGC has neither PerHeapCondemnedReasons nor GlobalCondemnedReasons. Skip such events instead of adding null rows to the table.AddConcurrentPauseTimeinTraceManagedProcess.cshad aDebug.Assert(_event.PauseDurationMSec == 0)that was always wrong for BackgroundGCs: the GCStart handler intentionally pre-seedsPauseDurationMSec = SuspendDurationMSecfor BGCs, so by the time the initial RestartEEStop fires the value is non-zero by design. The else branch's assignment then correctly replaces it with the full pause. Remove the bogus assertion.Fixes #2414