惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
腾讯CDC
博客园 - Franky
S
SegmentFault 最新的问题
美团技术团队
阮一峰的网络日志
阮一峰的网络日志
J
Java Code Geeks
Y
Y Combinator Blog
Engineering at Meta
Engineering at Meta
Microsoft Security Blog
Microsoft Security Blog
MongoDB | Blog
MongoDB | Blog
I
InfoQ
T
Tailwind CSS Blog
Hugging Face - Blog
Hugging Face - Blog
B
Blog RSS Feed
博客园 - 叶小钗
博客园_首页
有赞技术团队
有赞技术团队
雷峰网
雷峰网
量子位
小众软件
小众软件
月光博客
月光博客
U
Unit 42
D
DataBreaches.Net

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Stop Parsing Raw Stack Traces: Debugging Virtual Thread D...
Machine coding Master · 2026-06-15 · via DEV Community

Machine coding Master

Stop Parsing Raw Stack Traces: Debugging Virtual Thread Deadlocks with JDK 26 JSON Thread Dumps

If you are still running jstack or grepping through a 500MB plain-text thread dump to debug a virtual thread deadlock, you are wasting valuable time. With millions of concurrent virtual threads now standard in modern high-throughput Java applications, traditional text-based thread dumps have become an unreadable, unparseable wall of text.

Heads up: if you want to see these patterns applied to real interview problems, javalld.com has full machine coding solutions with traces.

Why Most Developers Get This Wrong

  • Grepping raw text: Treating virtual threads like legacy platform threads and expecting standard regex to parse millions of concurrent stack traces without crashing your terminal.
  • Ignoring carrier thread mapping: Failing to map the underlying carrier thread (ForkJoinPool-1-worker-*) to the mounted virtual thread, leading to ghost deadlock diagnoses.
  • Manual pinning detection: Relying on developers to manually spot synchronized block pinning instead of programmatically querying the thread's mounting state.

The Right Way

Leverage JDK 26's native JSON thread dump output coupled with structured query tools to instantly isolate deadlocks and carrier thread pinning at scale.

  • Generate structured dumps: Trigger JSON-formatted dumps via jcmd <pid> Thread.dump_to_file -format=json <file>.
  • Query with jq: Parse the machine-readable output to filter for blockedOn objects, thread states, and carrier mappings.
  • Automate pinning checks: Programmatically scan the JSON for virtual threads stuck in transition states on carrier threads.

Show Me The Code (or Example)

Run this single-line jq command to extract only the deadlocked virtual threads along with their associated carrier threads from a JDK 26 JSON thread dump:

jq '.threads[] | select(.isVirtual == true and .state == "BLOCKED") | {
  virtualThreadId: .tid,
  name: .name,
  blockedOnObject: .blockedOn.object,
  blockedByThread: .blockedOn.ownerThreadId,
  carrierThread: .carrierThread // "none"
}' thread_dump.json

Key Takeaways

  • Ditch jstack: jstack is legacy; jcmd with -format=json is the standard for modern observability pipelines.
  • Automate diagnostics: Build automated alerts in your CI/CD or APM using structured JSON parsing rather than brittle regex.
  • Watch the carrier: Always correlate the virtual thread's state with its carrier thread to diagnose performance degradation from pinning.