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

CRIU DebugOnRestore mode is disabled when debug events are hooked #20891

Merged
merged 1 commit into from
Feb 19, 2025

Conversation

JasonFengJ9
Copy link
Member

@JasonFengJ9 JasonFengJ9 commented Jan 7, 2025

CRIU DebugOnRestore mode is disabled when debug events are hooked

  • isDebugOnRestoreEnabled() returns false if some debug-specific flags/events are enabled/hooked, this matches J9::Options::isFSDNeeded() in compiler/control/J9Options.cpp;
  • DebugOnRestore mode is enabled when CRIU is enabled, -XX:+DebugOnRestore is specified, JDWP is not enabled, and no debug-specific flags/events are enabled/hooked;
  • When DebugOnRestore mode is enabled, debug-related events and hooks can't be enabled or hooked pre-checkpoint,
    isDebugAgentDisabled() returns TRUE in this case, otherwise FALSE;
  • Moved the agent load/start into criuRestoreInitializeLib() triggered by TRIGGER_J9HOOK_VM_PREPARING_FOR_RESTORE;
  • Avoid AddCapabilities() for
    can_generate_single_step_events/can_generate_frame_pop_events/can_generate_field_modification_events/can_generate_field_access_events such that JIT won't enter FSD post-restore if there is no JDWP agent specified within the restore option file;
  • Renamed jvmtiHookVMRestoreCRIUInit() to jvmtiHookVMPreparingForRestore(), and jvmtiHookVMRestoreStartAgent() to jvmtiHookVMCRIURestore() to match the hook trigger events.

Signed-off-by: Jason Feng [email protected]

@JasonFengJ9 JasonFengJ9 added comp:vm criu Used to track CRIU snapshot related work labels Jan 7, 2025
@JasonFengJ9 JasonFengJ9 requested review from tajila and dsouzai January 7, 2025 22:45
runtime/vm/CRIUHelpers.cpp Outdated Show resolved Hide resolved
@JasonFengJ9 JasonFengJ9 marked this pull request as draft January 13, 2025 18:46
@JasonFengJ9
Copy link
Member Author

Marking this as WIP until a proper way determining the debug on restore mode is found.

@JasonFengJ9 JasonFengJ9 marked this pull request as ready for review January 21, 2025 21:43
@tajila
Copy link
Contributor

tajila commented Feb 10, 2025

jenkins test sanity alinux jdk21

@tajila
Copy link
Contributor

tajila commented Feb 10, 2025

jenkins test sanity,extended.functional xlinux jdk17

@JasonFengJ9
Copy link
Member Author

19:09:28 cmdLineTester_criu_jitPostRestore_3_FAILED

Looking into it.

isDebugOnRestoreEnabled() returns false if some debug-specific
flags/events are enabled/hooked, this matches J9::Options::isFSDNeeded()
in compiler/control/J9Options.cpp;
DebugOnRestore mode is enabled when CRIU is enabled, -XX:+DebugOnRestore
is specified, JDWP is not enabled, and no debug-specific flags/events
are enabled/hooked;
When DebugOnRestore mode is enabled, debug related events
and hooks can't be enabled or hooked pre-checkpoint,
isDebugAgentDisabled() returns TRUE in this case, otherwise FALSE;
Moved the agent load/start into criuRestoreInitializeLib() triggered by
TRIGGER_J9HOOK_VM_PREPARING_FOR_RESTORE;
Avoid AddCapabilities() for
can_generate_single_step_events/can_generate_frame_pop_events/can_generate_field_modification_events/can_generate_field_access_events
such that JIT won't enter FSD post-restore if there is no JDWP agent
specified within the restore option file;
Renamed jvmtiHookVMRestoreCRIUInit() to
jvmtiHookVMPreparingForRestore(), and jvmtiHookVMRestoreStartAgent() to
jvmtiHookVMCRIURestore().

Signed-off-by: Jason Feng <[email protected]>
@JasonFengJ9
Copy link
Member Author

Moved the agent load/start into criuRestoreInitializeLib() triggered by TRIGGER_J9HOOK_VM_PREPARING_FOR_RESTORE;
Avoid AddCapabilities() for
can_generate_single_step_events/can_generate_frame_pop_events/can_generate_field_modification_events/can_generate_field_access_events such that JIT won't enter FSD post-restore if there is no JDWP agent specified within the restore option file;
Renamed jvmtiHookVMRestoreCRIUInit() to jvmtiHookVMPreparingForRestore(), and jvmtiHookVMRestoreStartAgent() to jvmtiHookVMCRIURestore() to match the hook trigger events.

This still allows JDWP agents to be enabled post-retore.

@tajila This is ready for another look.

@tajila
Copy link
Contributor

tajila commented Feb 15, 2025

jenkins test sanity,extended.functional xlinux jdk17

@tajila tajila merged commit e2516e2 into eclipse-openj9:master Feb 19, 2025
7 checks passed
@JasonFengJ9 JasonFengJ9 deleted the debugonrestore branch February 19, 2025 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:vm criu Used to track CRIU snapshot related work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants