Fix spurious BROKEN frame at top of Linux thread stacks in CPU Stacks viewer#2375
Fix spurious BROKEN frame at top of Linux thread stacks in CPU Stacks viewer#2375
Conversation
… viewer Co-authored-by: brianrob <6210322+brianrob@users.noreply.github.com>
|
Confirmed fixed. The before image has 39 seconds of samples where stacks are broken - the top hitter being libc.so.6!__clone3 which is a valid stack thread base. The after image shows that this is fixed and there is only 130ms of time where stacks are broken - the frames implicated aren't valid stack thread base methods. |
leculver
left a comment
There was a problem hiding this comment.
I don't generally love Regex as a solution most of the time, but I think you might solidly be in the realm of using a regex here. It would be weird, but plenty of things could match "libc[.-].*.so", which is effectively what you are doing. Usually regex is the wrong option, but better validation wouldn't hurt.
I think matching $@"^libc(-\d+\.\d+)?\.so(\.\d+)?" is what you would want.
I don't think this will hurt anything, so I'm marking approve. I leave it up to you if you want to make the change or just merge this. I haven't considered whether ".so" is always appended or if you truncate that to "libc-3.4" (no .so), and what happens in the .so.68 case, so it might require work workshopping beyond my regex...so don't overcomplicate it if you don't want to.
Thanks @leculver. I'm going to stick with the current change. I looked into the Regex option, but it's a bit more complex than I'd like here. The risk is also quite low here since this just controls whether or not we render a BROKEN frame. The risk is of a false positive and we don't explicitly render a BROKEN frame. |


Linux EventPipe traces show a spurious
BROKENframe between the thread root and the actual bottom frame (libc.so.6!__clone3) becauseReasonableTopFrame()only recognized Windows thread-root modules (ntdll.dll,ntoskrnl.exe) as valid stack tops.Changes
ReasonableTopFrame()inTraceEventStackSource: Recognizelibcmodule variants as valid thread root modules — matcheslibc,libc.so,libc.so.6,libc-2.31.so, etc., but not unrelated libs likelibcrypto.GetCallStack()inMutableTraceEventStackSource: Mirror the same libc check to prevent insertion of aBROKENframe when the bottom-most frame is in libc.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.