-
Notifications
You must be signed in to change notification settings - Fork 72
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
Add support for a suspendOnRestore option in JDWP #591
base: openj9
Are you sure you want to change the base?
Conversation
9f9fb2a
to
0347dac
Compare
@JasonFengJ9 Please review |
jenkins copyright check |
This is a new file, it can go to closed/src, and the Copyright is
In addition, there is a line ending check error
|
Only IBM Copyright is required if this is not a file originating from OpenJDK. |
Not sure if there's any reason it can't be in the OpenJ9 repo instead, but I put it in the extension repo since the I'll see if moving it to closed/src or the OpenJ9 repo makes more sense. |
cca3448
to
d8c480e
Compare
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 is a CRIU feature, the java code can be decorated w/ CRIU_SUPPORT
, and the native code w/ J9VM_OPT_CRIU_SUPPORT
, just created
9e36465
to
030a88f
Compare
Rebased on top of d1ba4a1 and added ifdefs so that the new code only compiles with CRIU enabled. Also addressed formatting review comments. @JasonFengJ9 ready for another look. |
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.
- Recognize OpenJ9 flags in openjdk jcl natives #592
is merged, please rebase.
030a88f
to
739e564
Compare
Rebased on the merged commit and updated to address review comments. |
src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java
Outdated
Show resolved
Hide resolved
src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java
Outdated
Show resolved
Hide resolved
It's safer to just include |
|
I'm not thrilled with this approach. Changing JDWP means no other debuggers will be able to use the new event. |
Another debugger not using JDWP should still be able to add their own callbacks for the
If a debugger is already attached then |
64fc4d8
to
80cbc32
Compare
Do you have any other concerns about this or the openj9 PR @keithc-ca? |
80cbc32
to
3f94b84
Compare
I still think the overall behavior should be as I described in #591 (comment). Consider the expanded use-cases where more than one checkpoint is taken in the progression towards increasingly customized applications. The distinction of suspending before a checkpoint versus suspending after one ceases to be clear. Between the first and last checkpoints what would a user be expected to say or do? I think the answer should be simply, "use the agent, with or without suspend=y, to debug the phase of interest". |
I think its important to recognize that while in theory there can be infinite checkpoint and restore phases, there can only be one VM start up phase and In practical use cases there will only be one restore because of the limitations imposed by security APIs if multiple restores are permitted.
Im not opposed to that behaviour as a starting point, simply because this feature hasn't been in the field long enough to understand usage patterns. That being said, I can see a need for more flexibility beyond what you suggested. So perhaps something like the following could work: |
I have been assuming that debugging settings from one phase are not implicitly carried over into subsequent phases: users must explicitly specify that agent for any phase they want to debug. Is my assumption incorrect or inappropriate?
Perhaps an example that requires |
The options for the JDWP agent do currently persist through checkpoint and restore. |
JDWP options are only specified at startup. We are unable to dynamically enable JDWP after restore.
An example would be, you want to suspend on start, but not restore. |
We may have support for this in the future, but this is a med -> long term goal. |
This seems to me the fundamental issue we should be attacking. |
3f94b84
to
3b8e110
Compare
Recall, JVM restore is not a new start, it is a continuation of an existing process. So it is correct that options specified on startup should persist on restore. This is true for all JVM options, not just JDWP options. We have the ability to specify options on restore. However, if we allowed However, if we had Phases -> effect
When we are able to dynamically enable debug capabilities, we will be able to do: Phases -> effect So I dont see it as an issue, it is really a point in time limitation. One could make the arguement, that |
I repeat my concerns about this approach. In order to debug any phase in the evolution of an application through one or more checkpoints, the JDWP agent must be enabled in the very first phase (and based on comments above, every phase). The producer of an application must enable the agent unless they are prepared to accept the consequence that no customers will be able to debug their use of the product. Enabling the JDWP agent has associated performance implications: all subsequent phases will pay those costs even when debugging is not needed. Using It may be that the VM needs to provide suspend and restore events, but to my mind this doesn't represent the way they should be handled. |
Currently, even without CRIU, the JDWP agent must be enabled at start up due to the capabilities needed. Regardless of CRIU, using JDWP for debug means you're taking the performance hit for the entire run of an application.
Enabling JDWP is the user's decision at run time, so consequences are determined by the user each run. |
LUDCL refresh points
Added a commit CRIU supports Java debugger during checkpoint and restore
|
@tajila @keithc-ca could you please review this PR to enable CRIU supports Java debugger during checkpoint and restore? Note: I added a commit CRIU supports Java debugger during checkpoint and restore at the top of initial changes. |
To help debug issues with checkpoint/restore, add an option similar to "suspend=y" which suspends on VM startup except this new option will suspend when the VM is restored from a checkpoint. To that end, this PR adds support for a VM_Restore JVMTI event to JDWP and JDB. Signed-off-by: Mike Zhang <mike.h.zhang@ibm.com>
Added an option suspendOnRestore which suspends when the VM is restored from a checkpoint; The existing option "suspend=y" also suspends the VM at restore. Signed-off-by: Jason Feng <fengj@ca.ibm.com>
JDK21 benchmark results with this PR (default settings, no JDWP):
This benchmark result shows that this PR has no noticeable perf impact when the JDWP is not enabled. |
To help debug issues with checkpoint/restore, add an option similar to "suspend=y" which suspends on VM startup except this new option will suspend when the VM is restored from a checkpoint.
To that end, this PR adds support for a VM_Restore JVMTI event to JDWP and JDB.
depends on eclipse-openj9/openj9#17252
@tajila @JasonFengJ9 can you please take a look?