Skip to content

Add support for JCMD and the Attach API #8915

@roberttoyonaga

Description

@roberttoyonaga

TL;DR

Support executing commands issued fromjcmd and support connection to SubstrateVM through the Attach API.

Motiviation

Native Image currently doesn't support jcmd. Currently, we work around this by relying on catching and handling Linux signals for many things. Examples include, generating heap dumps, dumping threads, generating NMT reports. JFR also cannot dynamically be controlled at runtime (unless JMX is used). Signals are not ideal because there are a limited number of usable signals. They are also not ideal because arguments cannot be specified. jcmd would solve these problems because it would allow for an unlimited number of commands and also allows for arguments.

Implementing the Attach API also opens the door to the possibility of other Java tools like jmap, jstack, etc being supported in the future.

Goals

Describe the solution you'd like.

  • Implement the Attach API in SubstrateVM
  • Lay groundwork for issuing commands via jcmd. Focus on NMT, heap dumps, and JFR commands for now.

Non-Goals

  • Support Java agents using dynamic attach.
  • Support jmap, jstack, or other tools that use the Attach API
  • Support all jcmd commands. The goal is to put the piping in place and support a few commands to start with.

Metadata

Metadata

Type

No type

Projects

Status

Released

Relationships

None yet

Development

No branches or pull requests

Issue actions