jstack

Captures and analyzes Java thread dumps from XTDB to diagnose deadlocks and hangs.

3.0k|192|Updated Mar 19, 2018
One-click install
npx skills add https://github.com/xtdb/xtdb --skill jstack
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: jstack
Source: https://github.com/xtdb/xtdb/tree/main/.claude/skills/jstack
Command: npx skills add https://github.com/xtdb/xtdb --skill jstack

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When an XTDB test run, node, or Gradle worker hangs, diagnosing the cause requires capturing and interpreting a Java thread dump — a file containing tens of thousands of tokens of stack traces that is impractical to read directly. This Skill guides the capture of dumps from running Gradle workers and delegates the parsing to a sub-agent so the dump stays out of the main context.

Core Features & Use Cases

  • Thread dump capture: Uses jps and jstack to snapshot a running GradleWorkerMain process, with guidance for handling multiple workers.
  • Delegated analysis: Sends the dump file path to a cheap-model sub-agent that reports deadlocks, blocked threads, lock contention, thread-state distribution, pool health, and repeated stacks.
  • XTDB-aware interpretation: Maps findings onto XTDB subsystems via allocator and executor names, and recommends comparing two dumps taken seconds apart to distinguish livelocks from true deadlocks.
  • Use Case: A Gradle test run stops making progress. Capture a dump with jstack, delegate the parse to a sub-agent, and receive a report identifying an exhausted thread pool as the root cause.

Quick Start

Ask the assistant to capture a thread dump from the hung Gradle worker and analyze it for deadlocks and blocked threads.

Frequently Asked Questions about jstack

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I capture a Java thread dump from a running Gradle worker?

Run jps -l and grep for GradleWorkerMain to find the PID, then run jstack <PID> redirected to a file such as /tmp/jstack-<PID>.txt. If multiple workers exist, confirm which PID to analyze or capture all of them.

How do I analyze a jstack thread dump for deadlocks?

Delegate the dump file path to a sub-agent rather than reading it directly, since dumps are tens of thousands of tokens. Ask for deadlocks, blocked threads, lock contention, thread-state counts, pool health, and repeated stacks.

Why should thread dump analysis use a sub-agent instead of reading the file?

A thread dump is mostly irrelevant stack traces, and loading it consumes the main context. A cheap model handles the mechanical pattern-matching, returning only findings with thread names, lock addresses, and supporting stack excerpts.

How can I tell a livelock from a true deadlock in a thread dump?

A single dump is only one instant, so take two dumps a few seconds apart and compare them. A thread stuck in the same frame across both dumps is a much stronger signal than one sampled once.

What does an exhausted thread pool in a dump indicate?

A pool whose threads are all blocked or waiting is exhausted, and that is usually the cause rather than a symptom. Map the allocator or executor name to the XTDB subsystem, since the blockage often originates in a different subsystem.