JDK-8341406 : Remove the option onjcmd from the jdwp agent
  • Type: CSR
  • Component: core-svc
  • Sub-Component: debugger
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 24
  • Submitted: 2024-10-02
  • Updated: 2024-10-18
  • Resolved: 2024-10-18
Related Reports
CSR :  
Relates :  
Description
Summary
======
Remove the onjcmd option from the jdwp agent, because it is considered obsolete and unused.

Problem
=====

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 enabled, but without an open port to attach to until triggered, and with less performance penalty compared to starting the VM with fully armed debugging. So it offered a form of "On demand debugging".

However, it is not needed anymore, as the performance issue has been fixed, and the networking/open port topic can easily be handled by infrastructure. Furthermore, the option is rarely used due to being hidden via JDK-8227078. So, we should remove the feature along with its coding to reduce complexity.

Solution
=====
Remove the onjcmd option from the JDWP agent and eliminate the corresponding VM.start_java_debugging command in the JVM. This will clean up the agent code and remove obsolete functionality that is no longer needed or used.

Specification
========

All the changes mentioned in the solution are also removed, plus the `OnJcmdTest` is removed, and `TestAgentEvent` is fixed. The diff can be found in the PR: https://github.com/openjdk/jdk/pull/21387.

Comments
Hmm, I suppose since the documentation of the feature was already hidden, removing the feature doesn't involve any spec/interface changes. Moving to Approved.
18-10-2024

[~jbechberger]You have moved it to Finalized. Now you just need to wait for the CSR approval to happen.
11-10-2024

[~cjplummer] what is needed to finish this CSR?
11-10-2024

Can we remove the code diffs from the Specification section? What would normally appear is this section for this type of change is the diff to the documentation or help output. But since that was already removed, I'm not so sure we need any additional details in this section. The text of the Solution section is covering the changes from the user's perspective. Maybe just reference it or repeat it.
08-10-2024

Looks good with the changes made to the PR.
08-10-2024

It is meant that the JDWP agent can be started (in server mode) without having a port listening for connections. This would then only be triggered by the jcmd. However, in e.g. a cloud deployment, it would be no problem if a process/container is already listening but the firewall does not allow a connection and would only open it if some cloud orchestration tells it to do so.
07-10-2024

Can you elaborate on what is meant by the "networking/open port topic"? I don't see it mentioned in the CSR that introduced this feature.
07-10-2024

I have made some edits to the CSR text. I suggest to propose the code change in a PR and reduce the specification diff here to a few essential lines.
07-10-2024

I modified the diff so that all lines added by the original change are now removed.
04-10-2024

Please check debugInit.c ; e.g. variable allowStartViaJcmd is the declaration still needed ? Please compare to the additions of https://hg.openjdk.org/jdk/jdk/rev/21dfea980e23 .
04-10-2024

The original change is: https://hg.openjdk.org/jdk/jdk/rev/21dfea980e23
04-10-2024

The changes are also present in my https://github.com/parttimenerd/jdk/tree/parttimenerd_onjcmd_csr fork of the OpenJDK.
04-10-2024

Moving to Provisional, not Approved. [~jbechberger], please have one or more engineers familiar with jdwp review this CSR before it is Finalized for the second phase of CSR review.
03-10-2024

Setting Scope to JDK.
02-10-2024