[crac] RFR: 8347062: [CRaC] Support checkpoint/restore in JDWP

Timofei Pushkin tpushkin at openjdk.org
Wed Jan 8 10:15:17 UTC 2025


Adds debugger support for CRaC. The following description was provided by @wkia (who is the author of the implementation itself).

JDWP defines three new functions:
- `OnBeforeCheckpoint` callback
- `OnAfterRestore` callback
- `subscribe_crac_events` function which is called on `Agent_OnLoad` and sets the callbacks for CRaC events

Currently the following scenarios are possible for users running their application with `-agentlib:jdwp=transport=dt_socket,server=y`:
1. Application was run with `suspend=n`
  - Socket is closed before checkpoint and opened after restore
  - After restore the app will continue running
2. Application was run with `suspend=y`, the debugger is disconnected on checkpoint
  - Socket is closed before checkpoint
  - Socket is opened after restore, JDWP waits for an incoming connection blocking the restoration process
  - After the connection is established restore completes and the app will continue running; the user needs to run `suspend` command in debugger to suspend the app
3. Application was run with `suspend=y`, the debugger is still connected on checkpoint
  - Socket is closed before checkpoint, the debugger is disconnected
  - Socket is opened after restore, JDWP waits for an incoming connection blocking the restoration process
  - After the connection is established restore completes and the app will continue running; the user needs to run `suspend` command in debugger to suspend the app

-------------

Commit messages:
 - JdwpTransportTest fails with NullPointerException
 - Test fail on Windows with timeout
 - Revert line ending conversion in socket_md.c
 - Support checkpoint/restore in JDWP

Changes: https://git.openjdk.org/crac/pull/174/files
  Webrev: https://webrevs.openjdk.org/?repo=crac&pr=174&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8347062
  Stats: 305 lines in 9 files changed: 301 ins; 0 del; 4 mod
  Patch: https://git.openjdk.org/crac/pull/174.diff
  Fetch: git fetch https://git.openjdk.org/crac.git pull/174/head:pull/174

PR: https://git.openjdk.org/crac/pull/174


More information about the crac-dev mailing list