Skip to content

Add support for new exception trace storage format - #4635

Merged
mikem8361 merged 1 commit into
dotnet:mainfrom
janvorli:add-support-for-new-exception-stack-trace-storage
Jun 3, 2024
Merged

mikem8361 merged 1 commit into
dotnet:mainfrom
janvorli:add-support-for-new-exception-stack-trace-storage

Conversation

@janvorli

Copy link
Copy Markdown
Member

To eliminate global spinlock in stack trace saving to exceptions, the format of the stack trace storage has changed. The _stackTrace array can now be either a byte[] with the actual stack trace as before or an object[] where the first element references the byte[] with the actual stack trace and the following elements contain references to System.Resolver or System.Reflection.LoaderAllocator instances that keep code of methods that can be collected alive.

This change modifies SOS to handle the object[] case properly, while staying compatible with the old way. Since the same code to get the stack trace was duplicated at two places, I have taken this opportunity to refactor it into a separate function.

To eliminate global spinlock in stack trace saving to exceptions, the
format of the stack trace storage has changed. The `_stackTrace` array
can now be either a byte[] with the actual stack trace as before or an
object[] where the first element references the byte[] with the actual
stack trace and the following elements contain references to
System.Resolver or System.Reflection.LoaderAllocator instances that keep
code of methods that can be collected alive.

This change modifies SOS to handle the object[] case properly, while
staying compatible with the old way. Since the same code to get the
stack trace was duplicated at two places, I have taken this opportunity
to refactor it into a separate function.
@janvorli janvorli added this to the 9.0.0 milestone Apr 23, 2024
@janvorli
janvorli requested a review from mikem8361 April 23, 2024 15:25
@janvorli janvorli self-assigned this Apr 23, 2024
@janvorli
janvorli requested a review from a team as a code owner April 23, 2024 15:25
@noahfalk

Copy link
Copy Markdown
Member

@janvorli - This looks like all previous versions of SOS that don't have this change won't work against new runtime versions so we probably want to bump the breaking change version number. Anyone who tries to use a version of SOS containing the old version number gets an error saying their SOS is out-of-date and they should update it.

I'll let Mike take a look at the rest of the code change but it looked good to me 👍

fyi @elinor-fung @lambdageek - this looks like an example where SOS is directly inspecting runtime internal data structures without using a DAC API. Whether the code stays in SOS or migrates to a new API that cDAC implements this parsing code would not work cross-bitness as-is.

@janvorli

Copy link
Copy Markdown
Member Author

@noahfalk thank you for pointing it out, I'll add bumping the version in the runtime change.

@mikem8361
mikem8361 merged commit 05f88f6 into dotnet:main Jun 3, 2024
hoyosjs added a commit that referenced this pull request Jun 8, 2024
- Update Alpine versions (#4589)
- Followup 1ES template changes (#4596)
- Fix Test Results tab in github UI (#4607)
- Move the symstore repo to diagnostics (#4603)
- Fix recent Alpine repo build (#4612)
- Fix issue #4611 - Switch to cross build for Alpine (#4621)
- Add waithandle to --clrevents option (#4624)
- Fix SOS unit tests dump generation fixture (#4636)
- Fix CONTRACT return type (#4649)
- [SymbolStore] Add support to index .NET Framework Runtime debugging
modules (#4616)
- [test][SOS] Disable OtherCommands Dumpmt test on Alpine (#4656)
- Supports collecting GCSettingsEvent for gc-collect profile (#4615)
- Update ipc-protocol.md (#4658)
- Fixing a case where we should set the RundownKeyword (#4662)
- Fix versioning of symstore ported assets (#4670)
- Add ubuntu 22.04 testing. Update 6,7 and 8 runtime versions (#4676)
- Update locker action version to update node version (#4682)
- Use managed identity for blob upload of release assets (#4680)
- Remove the symweb symbol server support (#4694)
- [RISC-V] Add gcinfodumper implementation. (#4703)
- Fix `pathto` SOS command. (#4706)
- Add support for new exception trace storage format (#4635)
- Change SOS breaking change from warning to error; better dotnet-dump
target errors (#4713)
- [Symbol] Add manifest generator (#4693)
- Remove references to obsolete storage account variables (#4719)
- Update DIA to 17.10.0-beta1.24272.1 (#4683)
- Reenable SDL requirements (#4722)

---------

Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Rich Lander <[email protected]>
Co-authored-by: Mike McLaughlin <[email protected]>
Co-authored-by: Jan Vorlicek <[email protected]>
Co-authored-by: Grégoire <[email protected]>
Co-authored-by: Tom McDonald <[email protected]>
Co-authored-by: Mitchell Hwang <[email protected]>
Co-authored-by: Andrew Au <[email protected]>
Co-authored-by: Noah Falk <[email protected]>
Co-authored-by: Mikhail Kurinnoi <[email protected]>
Co-authored-by: Matt Mitchell <[email protected]>
hoyosjs added a commit that referenced this pull request Jun 12, 2024
- Update Alpine versions (#4589)
- Followup 1ES template changes (#4596)
- Fix Test Results tab in github UI (#4607)
- Move the symstore repo to diagnostics (#4603)
- Fix recent Alpine repo build (#4612)
- Fix issue #4611 - Switch to cross build for Alpine (#4621)
- Add waithandle to --clrevents option (#4624)
- Fix SOS unit tests dump generation fixture (#4636)
- Fix CONTRACT return type (#4649)
- [SymbolStore] Add support to index .NET Framework Runtime debugging
modules (#4616)
- [test][SOS] Disable OtherCommands Dumpmt test on Alpine (#4656)
- Supports collecting GCSettingsEvent for gc-collect profile (#4615)
- Update ipc-protocol.md (#4658)
- Fixing a case where we should set the RundownKeyword (#4662)
- Fix versioning of symstore ported assets (#4670)
- Add ubuntu 22.04 testing. Update 6,7 and 8 runtime versions (#4676)
- Update locker action version to update node version (#4682)
- Use managed identity for blob upload of release assets (#4680)
- Remove the symweb symbol server support (#4694)
- [RISC-V] Add gcinfodumper implementation. (#4703)
- Fix `pathto` SOS command. (#4706)
- Add support for new exception trace storage format (#4635)
- Change SOS breaking change from warning to error; better dotnet-dump
target errors (#4713)
- [Symbol] Add manifest generator (#4693)
- Remove references to obsolete storage account variables (#4719)
- Update DIA to 17.10.0-beta1.24272.1 (#4683)
- Reenable SDL requirements (#4722)
- Disable CG on musl leg due to lack of proper support (#4726)
- Update SOS breaking change version for Exception's _stackTrace changes
in .NET 9 (#4733)
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants