feat(run): Dump Threads for JVM run and debug sessions, with deadlocks (#5595)

Run › Dump Threads (Run tool window toolbar, for running Java applications, JAR applications, Gradle bootRun and Maven run goals) and Debug › Dump Threads (debugger toolbar menu) take a `Thread.print -l` of the JVM and open it in a thread viewer tab of the Run tool window: threads grouped by state with a filter and a toggle to hide JVM-internal threads, the selected thread's stack with navigable frames, deadlocks shown as a banner with the threads marked, and Refresh to take the next dump into the same tab.

- The run's JVM is the deepest HotSpot JVM of the run's process tree; Gradle runs, whose JVM forks under the daemon, are found by a stable -Dopenidea.run.token property instead, skipping Gradle's own JVMs.
- The attach listener is started only for a confirmed HotSpot JVM: the trigger file is private and created exclusively, a foreign socket is refused, and OpenJ9 is never sent SIGQUIT.
- A JVM a debugger holds suspended is dumped only when its listener is already open and the JDK is 17 or later; a debugged run's dump goes through its debug session, and Attach to Process links the session to the run.
- Remote runs, exited programs and JVMs with the attach mechanism disabled report why no dump was taken.
- The Run tool window comes forward when a dump opens, including one taken from the debugger.

Co-authored-by: ntbang0901 <[email protected]>
Цей коміт міститься в:
ntbang0901 authored and GitHub committed 2026-11-25 02:01:59 +08:00
1 джерело 8bc7fd76be
коміт 8492dc530a
52 files changed
+4238 -41

No files matched your search

+104
Переглянути файл
@@ -0,0 +1,104 @@
.root {
flex: 1;
display: flex;
flex-direction: column;
min-width: 0;
min-height: 0;
height: 100%;
}
.banner {
flex: none;
display: flex;
flex-direction: column;
gap: var(--space-0-5);
padding: var(--space-1) var(--space-3);
border-bottom: 1px solid var(--border);
background: color-mix(in srgb, var(--danger) 12%, transparent);
color: var(--fg-strong);
font-size: var(--fs-ui);
}
.cycle {
display: flex;
flex-wrap: wrap;
align-items: baseline;
gap: var(--space-1);
}
.cycleLabel {
color: var(--danger);
font-weight: 600;
}
.threadLink {
padding: 0;
border: none;
background: none;
color: var(--link);
font: inherit;
cursor: pointer;
}
.threadLink:hover {
color: var(--link-hover);
text-decoration: underline;
}
.body {
flex: 1;
display: flex;
min-width: 0;
min-height: 0;
}
.split {
flex: 1;
min-width: 0;
min-height: 0;
}
.threads {
display: flex;
flex-direction: column;
min-height: 0;
}
.listHeader {
flex: none;
display: flex;
align-items: center;
gap: var(--space-1);
padding: var(--space-1);
}
.filter {
flex: 1;
min-width: 0;
}
.counts {
flex: none;
display: flex;
flex-wrap: wrap;
gap: var(--space-0-5) var(--space-2);
padding: 0 var(--space-2) var(--space-1);
border-bottom: 1px solid var(--border);
color: var(--fg-subtle);
font-size: var(--fs-small);
}
.list {
flex: 1;
min-height: 0;
}
.name {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
}
.deadlockMark {
flex: none;
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--danger);
}
.stack {
display: flex;
flex-direction: column;
min-width: 0;
min-height: 0;
}