-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8370176: Mixed mode jhsdb jstack cannot unwind call stack with -Xcomp #27885
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
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back ysuenaga! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
/issue JDK-8370176 |
@YaSuenag The primary solved issue for a PR is set through the PR title. Since the current title does not contain an issue reference, it will now be updated. |
Webrevs
|
* @test | ||
* @bug 8370176 | ||
* @requires vm.hasSA | ||
* @requires os.family == "linux" |
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.
Do Windows and OSX have a similar problem that should be fixed also?
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.
This problem is in mixed mode (PStack
) only, thus we need to skip OSX because you mentioned mixed mode is not supported on OSX.
In Windows, I'm not sure, but I guess we need to consider UNWIND_INFO
to unwind call frames correctly like DWARF in Linux, however it hasn't done yet. Thus we can think mixed mode is not supported in Windows too, so I didn't add Windows here.
https://learn.microsoft.com/cpp/build/exception-handling-x64
Actually I could not see all of stacks as following in mixed mode. It works in normal mode (without --mixed
) of course. (I tested it on Windows 11 x64, upstream JDK built by VS 2022)
----------------- 13 -----------------
"Reference Handler" #15 daemon prio=10 tid=0x00000207280b9f70 nid=12684 waiting on condition [0x000000aaf6aff000]
java.lang.Thread.State: RUNNABLE
JavaThread state: _thread_blocked
0x00007fffa6b45844 ntdll!NtWaitForAlertByThreadId + 0x14
0x00000000ffffffff ????????
jhsdb jstack --mixed
would not work when attaches to the process runs with-Xcomp
.It has been reported by @pchilano in #27728. You can reproduce the problem with Test.java (attached JBS). You can see following stack.
Thread.sleepNanos0
is the bottom stack, but actually it has more call frames. You can see them with-XX:+PreserveFramePointer
.Java frame might be use the register for frame pointer (
RBP
in AMD64) as general purpose register, so SA cannot rely it in stack unwinding.hs_err log has mixed stack trace as "Native frames", it would be unwinded by
NativeStackPrinter
in HotSpot, and it works as mixed mode.NativeStackPrinter
usesframe::next_frame()
to find sender frame regardless whether Java frame or C frame, and it leverages sender FP/PC to create sender frame. On the other hand, SA separates CFrame and VFrame to unwind in mixed mode jstack, so sender FP/PC would not propagate to CFrame, thus the frame located at bottom of Java frame might not be shown.It is difficult to unify unwinder in
PStack
in SA, so it would be reasonable to propagate sender FP/PC to the sender of CFrame.Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/27885/head:pull/27885
$ git checkout pull/27885
Update a local copy of the PR:
$ git checkout pull/27885
$ git pull https://git.openjdk.org/jdk.git pull/27885/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 27885
View PR using the GUI difftool:
$ git pr show -t 27885
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/27885.diff
Using Webrev
Link to Webrev Comment