-
Notifications
You must be signed in to change notification settings - Fork 269
Prevent TieredPGO inlining from breaking stack trace walking logic #2620
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
Conversation
@@ -536,6 +538,7 @@ private static bool IsPlaywrightInternalNamespace(string namespaceName) | |||
namespaceName.StartsWith("Microsoft.Playwright.Helpers", StringComparison.InvariantCultureIgnoreCase)); | |||
} | |||
|
|||
[MethodImpl(MethodImplOptions.NoInlining)] // This method is also a stacktrace marker. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While not strictly necessary, it seems a good idea to make this explicit
Unfortunately I've done some further testing and it looks like a lot of the method names captured in the trace will change to base types, which isn't desired, I'll look to improve this PR. |
Update: So this PR fixes the playwright-dotnet/src/Playwright.Tests/TracingTests.cs Lines 69 to 75 in ca7b02a
we're going to need to sprinkle NoInlining over all of the public APIs. I've been thinking about other approaches that don't do stack frame walking, however some public APIs flow through other public APIs , for example Page.GotoAsync → Frame.GotoAsync (see here), which makes that harder to do in a non-breaking way.
|
So this is now working and tested with some traces. Unfortunately the cleanest way I could think to do this was add |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work!
{ | ||
if (!method.MethodImplementationFlags.HasFlag(MethodImplAttributes.NoInlining)) | ||
{ | ||
#pragma warning disable CA1305 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be nice to get rid of that.
@slang25 thank you so much for looking into this and @AndyAyersMS for filing it inside this repo with all the details! |
My pleasure @mxschmitt 🙂 |
Fixes #2617
I've recreated the issue locally on macOS on my M2 MBP, this fixes the exception, I need to check that the traces have the right API names captured still.