JDK-8336401 : Remove the option onjcmd from the jdwp agent
  • Type: Enhancement
  • Component: core-svc
  • Sub-Component: debugger
  • Affected Version: 24
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-07-15
  • Updated: 2024-10-24
  • Resolved: 2024-10-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 24
24 b21Fixed
Related Reports
CSR :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
The onjcmd mechanism was introduced through JDK-8214892 "Delayed starting of debugging via jcmd". It brought the possibility to start the JVM with debugging capabilities but without an open port to attach and with less performance penalty compared to starting the VM with fully armed debugging. So it offered a from of "On demand debugging".

However, the option was far from complete in the sense of a real "On demand debugging" such as envisioned by JDK-4841257. For debugging there is a requirement of certain JVMTI capabilities that currently need to be registered at JVM startup and can not be enabled on the fly. For a real "On demand debugging", the implementation would have to be changed to make these capabilites dynamic.

The performance penalty between starting with debugging agent enabled for use with onjcmd vs a fully loaded debugging agent was addressed in the meanwhile through JDK-8227269.

Also, the onjcmd implementation is lacking functionality to manage the debugging port, e.g. closing it or assigning it a different port number through jcmd etc.

As it stands, there's not much benefit left from the onjcmd facility and we should remove it to reduce technical debt. Maybe some of it will return if "On demand debugging" is ever addressed but then more thought needs to be spent into the whole thing.
Comments
Changeset: 309b9291 Branch: master Author: Johannes Bechberger <jbechberger@openjdk.org> Date: 2024-10-18 23:39:05 +0000 URL: https://git.openjdk.org/jdk/commit/309b929147e7dddfa27879ff31b1eaad271def85
18-10-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/21387 Date: 2024-10-07 11:47:12 +0000
07-10-2024