{
  "id": 15318140,
  "title": "What jstack Misses When Your Java Service Uses Virtual Threads",
  "url": "https://urgent.news/2026/10/18/what-jstack-misses-when-your-java-service-uses-virtual-threads",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-18T00:51:56.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/maschiojv/what-jstack-misses-when-your-java-service-uses-virtual-threads-23be"
  },
  "original_language": "en",
  "account": "When a Java service utilizes virtual threads, the traditional jstack tool may not accurately reflect the system's state, particularly if there are numerous requests in flight. For instance, consider a Spring Boot service with a HikariCP pool of 10 connections and around 5,000 requests in progress. Latency issues arise, and executing jstack yields 43 platform threads, primarily scheduler workers waiting in ForkJoinPool.awaitWork, with minimal CPU activity. However, jstack fails to list virtual threads on JDK 21 through 25, making it difficult to identify the requests waiting for database access.\n\nTo capture virtual threads and their associated information, the jcmd command with the Thread.dump_to_file option can be used. This command has been available since JDK 21 and generates a text or JSON file containing thread stacks. Compared to jstack, jcmd provides additional details such as thread ID, name, a virtual marker, state, timestamps, and lock information in JDK 25. It also allows for capturing multiple virtual threads and their parent-child relationships, which can help identify the root cause of the bottleneck.\n\nBy analyzing the captured dump files, one can examine the thread stacks and identify the resources causing delays, such as HikariPool.getConnection(). For example, if each request holds a connection for approximately 18 milliseconds, ten connections could take around nine seconds to clear a backlog of 5,000 requests, assuming no new requests are arriving. This information can guide further investigation into slow queries, transaction scope, and potential database performance issues. Ultimately, combining the dump analysis with system metrics can provide a comprehensive understanding of the performance issues and help optimize the service's resource utilization.",
  "summary": "Take a Spring Boot service with virtual threads enabled, a HikariCP pool of 10 connections, and roughly 5,000 requests in flight. Latency is climbing. You grab a thread dump and find 43 platform threads, most of the scheduler workers waiting in ForkJoinPool.awaitWork , and very little CPU activity. If you used jstack , the requests you're looking for may never have made it into the file. On JDK…",
  "key_points": [
    "jstack tool may miss virtual threads in JDK 21-25",
    "jcmd command with Thread.dumptofile captures virtual threads",
    "Analyzing dump files reveals resource causing delays"
  ],
  "editors_take": "Relying on jstack for debugging modern Java services creates visibility gaps that force developers to adopt jcmd to accurately diagnose bottlenecks caused by virtual threads and connection pool limitations.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}