DEV Community

Cover image for Can AI Diagnose JVM Incidents? Correlating GC Logs, Thread Dumps, and Heap Dumps
jvmind
jvmind

Posted on

Can AI Diagnose JVM Incidents? Correlating GC Logs, Thread Dumps, and Heap Dumps

Traditional JVM analysis tools parse logs.

JVMind runs a reasoning loop.

Instead of treating GC logs, thread dumps, and heap dumps as independent artifacts, JVMind’s AI Agent orchestrates a multi-step investigation process using a ReAct-style tool-calling architecture.

This article explains how that works under the hood.


The Core Problem: JVM Diagnostics Are Multi-Dimensional

A typical JVM incident involves multiple dimensions:

  • Memory allocation behavior (GC log)
  • Object retention structure (Heap dump)
  • Thread state and execution pattern (jstack)
  • Application execution logic

Most tools parse one of these dimensions.

But real root causes live in the intersections.

To detect those patterns automatically, JVMind uses a structured reasoning pipeline.


High-Level Architecture

JVMind is composed of four layers:

  1. Artifact Parsers (deterministic analyzers)
  2. Structured Signal Extractors
  3. ReAct-based AI Agent
  4. Evidence Correlation Engine

Conceptually:


Step 1 — Deterministic Parsing Layer

Before any AI reasoning begins, JVMind parses each artifact into structured data.


GC Log Analysis Interface

The GC report interface provides:

  • Allocation rate
  • GC frequency
  • Full GC ratio
  • Pause distribution
  • Throughput
  • Heap occupancy trend
  • Reclamation efficiency

BQACAgUAAyEGAASHRsPbAAEWqKBqSmM_LQ4DvP9Qx67QTtJVJ_I5eAAClCcAApTnUVa5zVjYCaGUiTwE.png

The output is converted into structured signals like:

  • high_full_gc_ratio
  • low_reclaim_efficiency
  • allocation_rate_exceeds_heap_capacity

Thread Dump (jstack) Analysis Interface

The jstack analyzer extracts:

  • Thread state distribution
  • Deadlocks
  • Lock chains
  • BLOCKED hotspots
  • RUNNABLE-heavy CPU scenarios
  • Executor patterns
  • Stack frame summaries

BQACAgUAAyEGAASHRsPbAAEWqKZqSmPAqS3tITek03FYNlBxlNIeAAObJwAClOdRVlribhRKqH1APAQ.png

This produces signals such as:

  • executor_waiting_pattern
  • high_runnable_ratio
  • no_deadlock_detected

Heap Dump Analysis Interface

The heap analyzer extracts:

  • Object count by class
  • Retained size
  • Dominator tree
  • Top memory consumers
  • Leak suspects
  • Ownership chains

BQACAgUAAyEGAASHRsPbAAEWqKVqSmO-CT-GJS2HNl0MFhuyUCOH-QACmicAApTnUVaZQGbD9Fx2nzwE.png

From this, structured signals are generated:

  • heap_domination_by_single_class
  • large_number_of_virtual_threads
  • dominant_executor_related_objects

Step 2 — Signal Structuring

Instead of letting the AI read raw logs, JVMind feeds it structured signals.

Each signal includes:

  • Metric value
  • Severity
  • Context
  • Supporting evidence
  • Confidence level

This prevents hallucination.

The AI agent reasons only on verified extracted facts.


Step 3 — ReAct-Based AI Agent

JVMind uses a ReAct-style reasoning loop.

ReAct = Reason + Act.

Instead of generating one large answer, the agent:

  1. Observes signals
  2. Forms a hypothesis
  3. Calls analyzer tools
  4. Gathers more evidence
  5. Refines reasoning
  6. Produces structured diagnosis

Agent Execution Interface

The Agent UI shows:

  • Observations
  • Tool calls
  • Intermediate reasoning
  • Evidence collection
  • Final structured diagnosis

BQACAgUAAyEGAASHRsPbAAEWqI1qSmGwg9ItxqOWWn0AARw6xDb-wFsAAn4nAAKU51FW4ZTqMVoU_VQ8BA.png

This transparency is critical.

The diagnosis is not a black box.

It shows how conclusions are reached.


Example: Virtual Thread Explosion

Let’s walk through the correlation process.


Phase 1 — GC Observation

Signals:

  • 266 GCs in 23 seconds
  • 107 Full GCs
  • Throughput 15.7%
  • Full GC reclaims zero bytes
  • Allocation rate 157 MB/s
  • Heap size 128 MB

Agent hypothesis:

Severe allocation pressure with low reclamation efficiency.


Phase 2 — Heap Correlation

Signals:

  • 191,782 VirtualThread instances
  • 74% heap retained
  • Dominator tree confirms VT ownership

Agent refines hypothesis:

Massive virtual thread accumulation dominating heap.


Phase 3 — Thread Behavior Analysis

Signals:

  • No deadlocks
  • Executor waiting in awaitTermination()
  • 51/56 threads RUNNABLE

Agent refines hypothesis:

Submission rate likely exceeds completion rate.


Phase 4 — Cross-Dimension Validation

The agent cross-validates:

  • Allocation rate vs heap size
  • Virtual thread count vs retained size
  • Executor state vs object retention

Final conclusion:

Unbounded virtual thread creation under undersized heap caused GC death spiral and OOM.


Structured Root Cause Output

Instead of free text, JVMind outputs:

  • Executive summary
  • Cross-artifact evidence
  • Root cause chain
  • Confidence level
  • Supporting metrics
  • Remediation recommendations

This makes the output production-ready.


Why ReAct Is Critical

Without tool-calling:

  • The model might blame GC
  • Or misinterpret RUNNABLE threads
  • Or miss heap dominance patterns

The ReAct loop enforces:

  • Evidence collection
  • Hypothesis validation
  • Cross-checking signals
  • Iterative refinement

It mimics how senior JVM engineers reason.


Hallucination Control

JVMind prevents hallucination by:

  • Deterministic parsing
  • Structured signals
  • Evidence linking
  • No free-form log interpretation
  • Confidence scoring

Every conclusion is tied to specific metrics and objects.


Why This Approach Matters

Manual JVM troubleshooting requires:

  • Context switching between tools
  • Deep JVM internals knowledge
  • Hours of cross-referencing

JVMind compresses that process into:

  1. Parsing
  2. Signal extraction
  3. ReAct reasoning
  4. Evidence-backed diagnosis

It does not replace engineers.

It accelerates them.


Final Thought

JVM incidents are interaction failures.

GC behavior.

Thread lifecycle.

Heap structure.

Application logic.

JVMind’s ReAct-based AI Agent reasons across these dimensions instead of summarizing them individually.

That is the difference between reading logs and diagnosing systems.


Try JVMind

Upload:

  • GC logs
  • Thread dumps
  • Heap dumps

And let JVMind correlate them automatically.

Demo available.

No signup required.

https://jvmind.io

Top comments (0)