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

Fix stack overflow reporting from native code #56774

Merged

Conversation

janvorli
Copy link
Member

@janvorli janvorli commented Aug 3, 2021

When stack overflow happens in native code, the stack walker is unable
to walk the stack and we end up reporting no call stack at all.
This issue was occurring on Windows only, Linux exception handling
unwinds the context to the first managed frame in the HandleHardwareException.

This change fixes it by first unwinding the exception context to the first
managed frame and then letting the stack walker to walk the frames.

Close #46279

When stack overflow happens in native code, the stack walker is unable
to walk the stack and we end up reporting no call stack at all.

This change fixes it by first unwinding the exception context to the first
managed frame and then letting the stack walker to walk the frames.
@janvorli janvorli added this to the 6.0.0 milestone Aug 3, 2021
@janvorli janvorli requested a review from davidwrighton August 3, 2021 12:50
@janvorli janvorli self-assigned this Aug 3, 2021
@janvorli
Copy link
Member Author

janvorli commented Aug 3, 2021

cc: @dotnet/dotnet-diag

@janvorli janvorli closed this Aug 3, 2021
@janvorli janvorli reopened this Aug 3, 2021
@janvorli
Copy link
Member Author

janvorli commented Aug 3, 2021

Hmm, I've forgotten that x86 doesn't have the VirtualUnwindToFirstManagedCallFrame function. That's why the x86 legs failed.

@janvorli janvorli merged commit 7d76a64 into dotnet:main Aug 4, 2021
@janvorli janvorli deleted the fix-stackoverflow-reporting-from-native-code branch August 4, 2021 20:00
@ghost ghost locked as resolved and limited conversation to collaborators Sep 3, 2021
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.

Test failure: baseservices\\exceptions\\stackoverflow\\stackoverflowtester\\stackoverflowtester.cmd
2 participants