Skip to content

feat(thread-dump): Enhancements for thread dump analyzer#389

Open
zachelnet wants to merge 14 commits into
eclipse-jifa:mainfrom
zachelnet:feature/thread-dump-backport
Open

feat(thread-dump): Enhancements for thread dump analyzer#389
zachelnet wants to merge 14 commits into
eclipse-jifa:mainfrom
zachelnet:feature/thread-dump-backport

Conversation

@zachelnet

@zachelnet zachelnet commented Jun 18, 2026

Copy link
Copy Markdown

Overview

This PR ports PR #231 by jutzig/SEEBURGER to the current Vue 3 / Spring Boot 3 codebase.


Changes

Backend (analysis/thread-dump)

  • Diagnoser: New ThreadDumpDiagnoser with configurable thresholds (ThreadDumpAnalysisConfig) detects the following issues:
    • Deadlocks
    • High blocked thread count
    • High total thread count
    • Threads with very large stacks
    • Threads with high CPU ratio
    • Threads throwing exceptions
  • New API endpoints:
    • diagnose() – runs all diagnostic checks
    • blockingThreads() – returns blocking/blocked thread trees
    • cpuConsumingThreads() – top N threads by CPU time
    • cpuConsumingThreadsCompare() – compare CPU usage across two snapshots
    • searchThreads() – full-text search with regex, field and state filters
    • threads() extended with threadState and ids parameters
  • Converter: Robust locale-aware number parsing (1.234,56 and 1,234.56)
  • New VOs: SearchHit, VBlockingThread, extended VThread
  • Tests: TestDiagnoser, TestConverter, updated TestAnalyzer

Frontend (Vue 3 / TypeScript)

  • New components:
    • Diagnose – displays diagnoser results with message, file and suggestion columns
    • BlockedThreads – D3.js tree diagram of blocking/blocked thread chains
    • CpuConsumingThreads – horizontal bar chart (ECharts) of top CPU threads
    • ThreadDumpSearch + ThreadDumpSearchForm – full-text thread search with regex, field selection, state filter and results table
    • ThreadDumpOverview – summary panel with state distribution (ECharts Doughnut), top CPU threads (ECharts Bar) and thread group summary
  • Charts (ECharts integration):
    • Automatic dark/light mode via watch(isDark)
    • Native resize() handler on window resize
    • Proper dispose() + removeEventListener on unmount
  • Thread state visualization:
    • Colored el-tag per state in Thread Summary and Thread Group Summary – clickable to filter threads by state
    • STATE_COLORS covers all actual enum values from JavaThreadState and OSThreadState (PARKED_TIMED, PARKED, IN_OBJECT_WAIT, IN_OBJECT_WAIT_TIMED, SLEEPING, BLOCKED_ON_MONITOR_ENTER, COND_VAR_WAIT, OBJECT_WAIT, MONITOR_WAIT, etc.)
  • i18n: Full English and Chinese translations for all new keys

AI Disclosure

This contribution was developed with AI assistance.

Assisted-by: GitHub Copilot (Claude Sonnet 4.5)

@zachelnet zachelnet closed this Jun 18, 2026
@zachelnet zachelnet reopened this Jun 18, 2026
@zachelnet zachelnet force-pushed the feature/thread-dump-backport branch from 20be784 to 2e175d4 Compare June 18, 2026 17:46
@zachelnet zachelnet changed the title feature: Enhancements for thread dump analyzer feat Enhancements for thread dump analyzer Jun 18, 2026
@zachelnet zachelnet force-pushed the feature/thread-dump-backport branch 2 times, most recently from 974d2fc to 20be784 Compare June 18, 2026 18:04
@zachelnet zachelnet changed the title feat Enhancements for thread dump analyzer feat(thread-dump): Enhancements for thread dump analyzer Jun 18, 2026
@zachelnet zachelnet force-pushed the feature/thread-dump-backport branch from 20be784 to c26b251 Compare June 19, 2026 05:15
…pring Boot 3

Backend (analysis/thread-dump):
- New diagnoser: ThreadDumpDiagnoser, Diagnostic, ThreadDumpAnalysisConfig
- ThreadDumpAnalyzer: diagnose(), blockingThreads(), cpuConsumingThreads(),
  cpuConsumingThreadsCompare(), searchThreads(), threads() with state/id filter
- Converter: robust locale-aware number parsing
- New VOs: SearchHit, VBlockingThread, extended VThread
- Tests: TestDiagnoser, TestConverter, TestAnalyzer updated

Frontend (Vue 3):
- New components: Diagnose, BlockedThreads (D3 tree), CpuConsumingThreads
  (ECharts bar), ThreadDumpSearch, ThreadDumpSearchForm, ThreadDumpOverview
- ThreadDump.vue: thread summary with clickable colored el-tags per state
- ThreadDumpOverview.vue: ECharts Doughnut + Bar charts with dark mode,
  resize handler and onUnmounted cleanup
- STATE_COLORS covers all JavaThreadState + OSTreadState enum values
- i18n: en.ts + zh.ts for all new keys

Assisted-by: GitHub Copilot (Claude Sonnet 4.5)
@zachelnet zachelnet force-pushed the feature/thread-dump-backport branch from c26b251 to f614d7a Compare June 19, 2026 05:28
@zachelnet zachelnet marked this pull request as draft June 19, 2026 07:56
@zachelnet zachelnet marked this pull request as ready for review June 19, 2026 08:29
@zachelnet

Copy link
Copy Markdown
Author

@D-D-H, could you please review my port of the enhancement for thread dump analysis?

@D-D-H

D-D-H commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

@D-D-H, could you please review my port of the enhancement for thread dump analysis?

Sure.

Could you please rebase your branch on main? We bumped Spring Boot version to 4.1 this week, so it's a good idea to sync up and make sure everything still builds fine.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Ports the Thread Dump Analyzer enhancements from the older Vue/Spring codebase into the current Vue 3 / Spring Boot 3 implementation, adding diagnostics, search, blocked-thread visualization, and CPU-focused analysis to improve thread-dump triage workflows.

Changes:

  • Backend: adds ThreadDumpDiagnoser + ThreadDumpAnalysisConfig, extends VOs (VThread) and introduces new VOs (Diagnostic, VBlockingThread, SearchHit), plus new analyzer endpoints (diagnose/search/blocking/CPU).
  • Backend: improves thread-dump time parsing to handle locale-specific number formats.
  • Frontend: adds new Thread Dump UI components (diagnosis, blocked threads via D3, CPU charts via ECharts, full-text search, overview dashboard) and i18n keys, plus adds d3 dependency.

Reviewed changes

Copilot reviewed 23 out of 26 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
NOTICE Adds contributor attribution for the thread-dump enhancements.
frontend/src/i18n/threaddump/zh.ts Adds Chinese translations for new thread-dump UI/diagnostics/search/overview strings.
frontend/src/i18n/threaddump/en.ts Adds English strings for new thread-dump UI/diagnostics/search/overview.
frontend/src/components/threaddump/ThreadDumpSearchForm.vue New advanced search form (term, regex, case-sensitivity, field + state filters).
frontend/src/components/threaddump/ThreadDumpSearch.vue New thread search results view with highlighted matches and state summary.
frontend/src/components/threaddump/ThreadDumpOverview.vue New “dump overview” dashboard with state distribution, top CPU threads, and group summary charts.
frontend/src/components/threaddump/ThreadDump.vue Integrates the new sections into the main Thread Dump page and adds state-based filtering.
frontend/src/components/threaddump/Thread.vue Extends thread list querying to support filtering by threadState and explicit ids.
frontend/src/components/threaddump/Diagnose.vue New diagnoser UI for displaying backend diagnostics and drilling into affected threads.
frontend/src/components/threaddump/CpuConsumingThreads.vue New CPU chart view (ECharts) showing top CPU-consuming threads with drill-down.
frontend/src/components/threaddump/BlockedThreads.vue New blocked-thread chain visualization (D3 tree) with drill-down.
frontend/package.json Adds d3 dependency for blocked-thread visualization.
frontend/package-lock.json Lockfile updates for d3 and transitive dependencies.
frontend/components.d.ts Adds Element Plus ElCol / ElRow typing entries used by new layouts.
analysis/thread-dump/src/test/resources/jstack_17_with_blocked.log New test fixture containing blocked threads + comma-decimal CPU/elapsed values.
analysis/thread-dump/src/test/java/org/eclipse/jifa/tda/TestDiagnoser.java New tests covering blocked-thread detection, CPU parsing, and diagnoser behavior.
analysis/thread-dump/src/test/java/org/eclipse/jifa/tda/TestConverter.java New tests for locale-aware numeric/time parsing (parseSecureDouble, str2TimeMillis).
analysis/thread-dump/src/test/java/org/eclipse/jifa/tda/TestAnalyzer.java Updates tests for the extended threads() method signature.
analysis/thread-dump/src/main/java/org/eclipse/jifa/tda/vo/VThread.java Extends VThread to include optional CPU/elapsed fields and constructors.
analysis/thread-dump/src/main/java/org/eclipse/jifa/tda/vo/VBlockingThread.java New VO representing a blocking thread, its blocked threads, and the held monitor.
analysis/thread-dump/src/main/java/org/eclipse/jifa/tda/vo/SearchHit.java New VO for search results including matched thread metadata and raw lines.
analysis/thread-dump/src/main/java/org/eclipse/jifa/tda/util/Converter.java Enhances time parsing; adds locale-aware numeric parsing helper.
analysis/thread-dump/src/main/java/org/eclipse/jifa/tda/ThreadDumpAnalyzer.java Adds diagnose/search/blocking/CPU endpoints and extends threads() filtering.
analysis/thread-dump/src/main/java/org/eclipse/jifa/tda/diagnoser/ThreadDumpDiagnoser.java New diagnoser implementation (deadlock, blocked threads, high thread count, stack size, CPU ratio, exceptions).
analysis/thread-dump/src/main/java/org/eclipse/jifa/tda/diagnoser/ThreadDumpAnalysisConfig.java New configuration object controlling diagnoser thresholds and toggles.
analysis/thread-dump/src/main/java/org/eclipse/jifa/tda/diagnoser/Diagnostic.java New diagnostic result model (severity, type, params, affected threads).
Files not reviewed (1)
  • frontend/package-lock.json: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread analysis/thread-dump/src/main/java/org/eclipse/jifa/tda/ThreadDumpAnalyzer.java Outdated
Comment thread frontend/src/components/threaddump/ThreadDumpSearch.vue Outdated
Comment thread frontend/src/components/threaddump/ThreadDumpSearchForm.vue
@y1yang0

y1yang0 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Great work

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 23 out of 26 changed files in this pull request and generated 8 comments.

Files not reviewed (1)
  • frontend/package-lock.json: Generated file

Comment thread frontend/src/components/threaddump/Diagnose.vue
Comment thread frontend/src/components/threaddump/Diagnose.vue Outdated
Comment thread frontend/src/components/threaddump/BlockedThreads.vue
Comment thread frontend/src/components/threaddump/CpuConsumingThreads.vue
Comment thread frontend/src/components/threaddump/ThreadDumpOverview.vue
Comment thread frontend/src/components/threaddump/ThreadDumpSearchForm.vue

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 23 out of 26 changed files in this pull request and generated 7 comments.

Files not reviewed (1)
  • frontend/package-lock.json: Generated file

Comment thread frontend/src/components/threaddump/BlockedThreads.vue
Comment thread frontend/src/components/threaddump/Diagnose.vue
Comment thread frontend/src/components/threaddump/ThreadDumpSearchForm.vue
Comment thread frontend/src/components/threaddump/ThreadDumpOverview.vue
Comment thread frontend/src/components/threaddump/BlockedThreads.vue
- Replace non-functional el-icon-* CSS classes (Element UI v2) with proper
  <el-icon> components from @element-plus/icons-vue: CircleCloseFilled for
  ERROR, WarningFilled for WARNING, CircleCheckFilled for OK, InfoFilled
  for other severities
- Move loading.value = false into .finally() so the spinner is always reset
  even when the diagnose request fails

Assisted-by: GitHub Copilot (Claude Sonnet 4.5)
Add onBeforeUpdate(() => { svgRefs.value = []; }) so that stale SVG
element references from removed list items are cleared before every
component update cycle – the Vue 3 recommended pattern for function
template refs used inside v-for.

Assisted-by: GitHub Copilot (Claude Sonnet 4.5)
…ified name

Add 'import java.text.ParsePosition' alongside the existing ParseException
import and remove the java.text. prefix from both usages in parseSecureDouble.
Keeps the import block consistent with the rest of the file.

Assisted-by: GitHub Copilot (Claude Sonnet 4.5)
…rman decimals

NumberFormat.getInstance(Locale.US) treats comma as a thousands separator,
so it parses "1,5" as 15.0 and "1,234" as 1234.0 – both wrong for JVM
thread dumps produced in a German locale.

Double.parseDouble() already handles all standard dot-decimal formats, so
the Locale.US step is redundant and harmful. Fall back directly to
Locale.GERMANY when Double.parseDouble fails. This was the original intent
of the Copilot suggestion (use ParsePosition + full-string validation).

Fixes 5 test failures in TestConverter:
  testParseSecureDouble_germanDecimalComma  "1,5"     expected 1.5   got 15.0
  testParseSecureDouble_ambiguousSingleComma "1,234"  expected 1.234 got 1234.0
  testParseSecureDouble_whitespace           "  1,5 " expected 1.5   got 15.0
  testMilliseconds_germanComma              "100,5ms" expected 100.5 got 1005.0
  testSeconds_germanComma                   "1,5s"    expected 1500  got 15000

Assisted-by: GitHub Copilot (Claude Sonnet 4.5)
vue-i18n v9 does not support t(key, count, namedValues) — the third
argument is treated as options, not named values, so {blocker} was
never interpolated. Pass a single named-values object instead; vue-i18n
uses the 'count' field automatically for pluralization.

Assisted-by: GitHub Copilot (Claude Sonnet 4.5)
The blocking thread name was rendered both in the <p> title above and
as the root node label in the D3 SVG (with y=-40 + overflow:visible),
causing the text to visually overlap the title row.

Only render text labels for leaf nodes (blocked threads); the blocking
thread is already prominently shown in the paragraph title.

Assisted-by: GitHub Copilot (Claude Sonnet 4.5)
@zachelnet

zachelnet commented Jun 26, 2026

Copy link
Copy Markdown
Author

Sure.

Could you please rebase your branch on main? We bumped Spring Boot version to 4.1 this week, so it's a good idea to sync up and make sure everything still builds fine.

Done! The branch is already rebased on main. All tests pass on the updated build.

While I was at it, I also fixed a few smaller issues I noticed during testing: a {blocker} placeholder not rendering in the Blocked Threads title, a duplicate label in the SVG tree view, and a German locale parsing bug in Converter.java.

D3 SVG text defaults to fill:black and links had hardcoded #ccc/eclipse-jifa#333
strokes — both invisible in dark mode. Read isDark at render time to
set text fill and link stroke to appropriate light/dark values.
Re-draw trees when the theme changes via watch(isDark).

Assisted-by: GitHub Copilot (Claude Sonnet 4.5)
@zachelnet

Copy link
Copy Markdown
Author

@D-D-H Thanks for review👍. All fixes are in place. Whenever you have a chance, would be great to get this merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants