Debugging

October 1, 2020 ยท View on GitHub

Andesite has plugins to support jattach for debugging. Prebuilt jars for them can be found on the releases page.

Jattach Plugin

All responses follow the format

{
    "exitCode": 123,
    "stderr": "",
    "stdout": ""
}

GET /debug/agent-properties

Returns agent properties

POST /debug/datadump

Prints heap and thread summary to the JVM's stdout. Returns no response to the client. Only included to cover all jattach commands.

GET /debug/file

Returns a file from the local machine. Useful to download heap dumps.

Query params:

keytypedescription
pathstringpath of the wanted file

POST /debug/heapdump

Dumps the JVM heap to the specified path.

Query params:

keytypedescription
pathstringpath to write the heap dump to

GET /debug/inspectheap

Returns a list of all live objects, including the number of instances, bytes used and class name, grouped by class.

POST /debug/jcmd

Runs a jcmd command. Use help or help --all for a list of valid commands.

Query params:

keytypedescription
commandstringcommand to execute

POST /debug/load

Loads an agent library.

Query params:

keytypedescription
pathstringpath to the library
absolutebooleanwhether or not the provided path is absolute, defaults to false
optionsstringoptions to pass to the agent. May be absent

GET /debug/printflag

Returns the value of a JVM flag.

Query params:

keytypedescription
flagstringflag to read

GET /debug/properties

Returns the JVM system properties present.

POST /debug/setflag

Updates a flag. Not all flags may be updated. A list of flags that can be updated can be obtained with

curl http://your-andesite-instance/debug/jcmd?command=VM.flags%20-all | jj stdout | grep manageable

Query params:

keytypedescription
flagstringflag to update
valuestringvalue to set

GET /debug/stack

Returns a thread dump of the VM