attached_action
Perform point-in-time actions on a connected JVM—thread and monitor dumps, heap dumps, MBean snapshots—to diagnose stalls, deadlocks, or memory issues.
Instructions
Perform a point-in-time action on the connected JVM: thread and monitor dumps, heap marking and heap dumps, MBean snapshots, and starting or stopping subsystem recording. Requires a recording session started with attach or prepare_profiling. The action names and parameters are the same as for the actions of recordingConfig.triggers.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cpu | No | Optional for 'startRecording'/'stopRecording': include CPU recording. | |
| label | No | Optional for 'mbeanSnapshot' and 'threadDump': label shown in the mbean.snapshots resp. threads.dumps dataset. In triggers the default is a name derived from the event. | |
| action | Yes | The action to perform on the attached JVM. 'threadDump': the current state and stack trace of every thread, grouped like in the JProfiler thread dumps view - use it when the app is slow but CPU usage is low, and take two dumps to find threads stuck at the same stack trace. 'monitorDump': the currently held and waited-on monitors with the involved threads and stack traces, plus deadlock detection over the current wait/own graph - deadlocks never appear in recorded monitor history because deadlocked events never finish, this dump is the way to find them, and no monitor recording is needed for it; attach-mode dumps show java.util.concurrent locks only, not intrinsic (synchronized) monitors. 'markHeap': mark all current heap objects as old, objects allocated afterwards count as new in heap dumps taken later in this session (generation argument of the heap datasets) - use it to bracket an operation of interest. 'mbeanSnapshot': capture the current JMX MBean attribute values into the session snapshot, for exploration usually unfiltered. 'heapDump': take a heap dump that becomes part of the session snapshot while the recording keeps running - expensive on large heaps, use create_heap_dump instead to stop the recording and analyze the heap immediately. 'startRecording'/'stopRecording': start or stop the recording of subsystems in this session, at least one of 'cpu', 'allocations', 'monitors', 'probes', 'complexity' is required - this does not end the session, use check_status with stopRecording for that. Dumps and snapshots taken by these actions become part of the session snapshot and are served by the threads.dumps, monitor.current, mbean.snapshots and heap.* datasets after the recording is stopped. For captures at events or from JVM start, configure actions with the same names in recordingConfig.triggers of attach or prepare_profiling. | |
| filter | No | Optional for 'mbeanSnapshot': regular expression matched against the domain and each property value of the MBean object names: "java.lang|com.mycompany.*" captures all MBeans in those domains, "Memory" the java.lang:type=Memory MBean. Without a filter all MBeans are captured, the right choice for exploration. | |
| fullGc | No | Optional for 'heapDump': run a full GC before the dump so only live objects are captured. Default true. | |
| probes | No | Optional for 'startRecording'/'stopRecording': probe names to start or stop, e.g. ["jdbc"], "custom:<fully qualified probe class name>" for custom probes of the profiled application, or "script:<name>" for a script probe defined in recordingConfig.advanced.scriptProbes. | |
| monitors | No | Optional for 'startRecording'/'stopRecording': include monitor recording. | |
| complexity | No | Optional for 'startRecording'/'stopRecording': include complexity recording - requires recordingConfig.advanced.complexityMethods in the same session. Use it to bound the measurement window, for example scoped to a method with a methodInvocation trigger, or to exclude a warmup phase. | |
| allocations | No | Optional for 'startRecording'/'stopRecording': include allocation recording. | |
| includeVirtualThreads | No | Optional for 'threadDump': take a virtual thread dump that includes all virtual threads and the thread container hierarchy in addition to the platform threads. Default false (platform threads only). Virtual threads require JDK 21+. |