Skip to content

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

Merged
D-D-H merged 25 commits into
eclipse-jifa:mainfrom
zachelnet:feature/thread-dump-backport
Jul 28, 2026
Merged

feat(thread-dump): Enhancements for thread dump analyzer#389
D-D-H merged 25 commits into
eclipse-jifa:mainfrom
zachelnet:feature/thread-dump-backport

Conversation

@zachelnet

@zachelnet zachelnet commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

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)
- Add spring-boot-starter-oauth2-client dependency
- Configure OIDC provider (Keycloak) via application.yml env vars:
  OIDC_ISSUER_URI, OIDC_CLIENT_ID, OIDC_CLIENT_SECRET
- UserServiceImpl: extract name from OIDC claims with fallback to
  preferred_username and principalName (prevents NPE)
- allow-login / allow-anonymous-access / allow-registration
  configurable via environment variables
- All three Keycloak vars must be set together; commented template
  in application.yml and docker-compose.yml

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
Contributor 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
Comment thread analysis/thread-dump/src/main/java/org/eclipse/jifa/tda/ThreadDumpAnalyzer.java Outdated
@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 Outdated
Comment thread analysis/thread-dump/src/main/java/org/eclipse/jifa/tda/ThreadDumpAnalyzer.java Outdated
Comment thread frontend/src/components/threaddump/ThreadDumpOverview.vue Outdated
Comment thread frontend/src/components/threaddump/ThreadDumpSearchForm.vue Outdated

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 analysis/thread-dump/src/main/java/org/eclipse/jifa/tda/ThreadDumpAnalyzer.java Outdated
Comment thread frontend/src/components/threaddump/ThreadDumpOverview.vue Outdated
Comment thread frontend/src/components/threaddump/BlockedThreads.vue Outdated
@zachelnet

zachelnet commented Jun 26, 2026

Copy link
Copy Markdown
Contributor 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.

@zachelnet

Copy link
Copy Markdown
Contributor Author

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

@zachelnet

zachelnet commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

Hi @D-D-H @y1yang0

Thank you for the feedback on rebasing. The branch is now synced with main and all tests pass with Spring Boot 4.1. During testing, I also fixed several issues:

  • {blocker} placeholder not rendering in Blocked Threads title
  • Duplicate label in SVG tree view
  • German locale parsing bug in Converter.java

The PR is ready for review whenever you have time. If a detailed walk-through of any section would be helpful, or if you'd prefer to review this in smaller chunks, I'm happy to accommodate.

Thank you! 🙏

@y1yang0 y1yang0 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.

Some of my suggestions and observations

  1. UI components are not center-aligned.
Image
  1. The font size and style are inconsistent. Additionally, it is expected that the red dot, like the blue dot, should have a label to clearly indicate to the user which one is ReferenceHandler and which one is Finalizer.
Image
  1. Ditto. The font size and style are inconsistent
Image
  1. The Java Thread State Distribution pie chart could perhaps be part of Basic Information, rather than being displayed at a later position on the page.

  2. The duplicated "Top CPU Consuming Threads" tables could be merged into a single collapsible panel, with a clear distinction between NonJavaThread and JavaThread.

Image

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)
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)
…iagnosis (Basic Information)

Assisted-by: GitHub Copilot (Claude Sonnet 4.6)
…variables

Assisted-by: GitHub Copilot (Claude Sonnet 4.6)
…ble regex

Assisted-by: GitHub Copilot (Claude Sonnet 4.6)
…r clarity

Assisted-by: GitHub Copilot (Claude Sonnet 4.6)
Assisted-by: GitHub Copilot (Claude Sonnet 4.6)
@zachelnet
zachelnet force-pushed the feature/thread-dump-backport branch from 372527f to 45c7014 Compare July 13, 2026 08:49
…RS to shared module

- Move window resize listener for state chart into onMounted/onUnmounted
  to prevent handler accumulation on repeated mount/unmount cycles
- Set stateChart = null after dispose() to release the reference
- Extract STATE_COLORS and stateColor() into thread-state-colors.ts
  so ThreadDump.vue and ThreadDumpSearch.vue share a single source of truth

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

zachelnet commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

Hi @mark8s, could you please review this PR?

It ports the thread-dump enhancement mentioned in #257 to the current codebase, including richer thread details (e.g., state/IDs) plus diagnoser, search, and CPU/blocking analysis views.
Thanks!

Backend (ThreadDumpAnalyzer):
- remove cpuConsumingThreadsCompare API whose parameter cannot be
  marshalled through the analysis API layer and which has no consumer
- cpuConsumingThreads: exclude threads without cpu data (cpu <= 0)
- searchThreads: apply name/state filters before any file I/O and read
  matched thread contents in a single sequential pass; propagate
  IOException instead of swallowing it

Frontend:
- ThreadDump: drop the state distribution pie chart; build the Total
  row state tags by merging per-type distributions (Java states for
  Java threads, OS states otherwise) so counts and tag clicks are
  consistent with backend thread filtering
- thread-state-colors: soft tinted tag style (light background,
  colored text/border) with a semantic, less saturated palette;
  works in light and dark themes
- ThreadDumpSearch: render results in a table (expandable stack rows,
  sortable CPU/elapsed columns) with an inline summary bar; stack
  content style matches Thread.vue
- ThreadDumpSearchForm: remove card wrapper, inline search input with
  appended button and 'More Options' toggle, left-aligned layout,
  aligned labels and section titles
- CpuConsumingThreads: query JIT/GC/VM types separately for the
  non-Java chart; center x-axis name to avoid clipped label
- Diagnose: shared table header style and icon/message alignment
- i18n: rename search section to 'Find Threads', clearer placeholder,
  rename keys (matchFields/matchFieldXxx/otherOptions)

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
@D-D-H

D-D-H commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@zachelnet

I've made some changes based on your branch with the help of GitHub Copilot.

Please take a look and see if they look good to you!

@D-D-H D-D-H assigned D-D-H and unassigned D-D-H Jul 15, 2026
@D-D-H
D-D-H requested review from D-D-H and y1yang0 and removed request for y1yang0 July 15, 2026 03:06
@zachelnet

Copy link
Copy Markdown
Contributor Author

@zachelnet

I've made some changes based on your branch with the help of GitHub Copilot.

Please take a look and see if they look good to you!

Thanks for making these improvements based on my branch — they look good! 👍

image

@D-D-H

D-D-H commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

There are still a few areas for improvement. I plan to address them and then merge this PR.

@zachelnet

Copy link
Copy Markdown
Contributor Author

Hi @D-D-H,

I noticed that the cpuConsumingThreadsCompare API part was removed. If it makes sense for you, we could also implement it in a separate PR.

@D-D-H

D-D-H commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Hi @D-D-H,

I noticed that the cpuConsumingThreadsCompare API part was removed. If it makes sense for you, we could also implement it in a separate PR.

Okay. Let's handle it in a separate PR.

Comment thread frontend/src/i18n/threaddump/zh.ts
Comment thread analysis/thread-dump/src/main/java/org/eclipse/jifa/tda/util/Converter.java Outdated
@D-D-H
D-D-H merged commit 9050f14 into eclipse-jifa:main Jul 28, 2026
2 checks passed
@zachelnet
zachelnet deleted the feature/thread-dump-backport branch July 29, 2026 12:32
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