dotCMS / dotCMS/core

[TASK] Implement thread dump and info endpoints

Open
#35,205 1 comment 0 reactions 0 assignees View on GitHub

A pull request for this has already been merged.

  • #35463 by @hassandotcms — merged
Team : Modernization
Dominant language
Java
Stars
970
Forks
486
Avg merge
3d 33m
Merged PRs (30d)
170

Description

Description

Implement GET /v1/maintenance/_threads and GET /v1/maintenance/_threads/info in MaintenanceResource.java. The thread dump returns structured JSON (not HTML) for all JVM threads. The info endpoint returns lightweight system startup and thread count data.

Acceptance Criteria

GET /v1/maintenance/_threads

  • API caller must receive a list of threads, each containing: name, id, daemon, priority, state, stackTrace (array of strings), lockedMonitors, lockedSynchronizers, lockInfo, lockOwnerName, lockOwnerId
  • API caller must see deadlock detection — each thread must have a deadlocked boolean flag based on ThreadMXBean.findDeadlockedThreads()
  • API caller must be able to filter system threads via hideSystem query param (default true) — when true, only threads with com.dotmarketing or com.dotcms in their stack traces are returned
  • Response must include: timestamp, vmInfo (JVM name + version), threadCount, deadlockedCount
  • Must require CMS Administrator role and Maintenance portlet access

GET /v1/maintenance/_threads/info

  • API caller must receive: systemStartupTime (formatted string), startTimeMillis (epoch), uptimeMillis, currentThreadCount, peakThreadCount
  • This is a lightweight call suitable for tab-load — no stack traces or heavy data
  • Must require CMS Administrator role and Maintenance portlet access
Priority

None

Additional Context
  • Thread data comes from ManagementFactory.getThreadMXBean().dumpAllThreads(true, true) — the two true params request locked monitors and locked synchronizers
  • Deadlock detection: ThreadMXBean.findDeadlockedThreads() returns array of thread IDs (or null)
  • Thread counts: ThreadMXBean.getThreadCount() and getPeakThreadCount()
  • Startup time: ManagementFactory.getRuntimeMXBean().getStartTime()
  • The DWR version uses reflection to get the internal eetop field for native TID — this can be omitted, ThreadInfo.getThreadId() is sufficient
  • DWR legacy: ThreadMonitorTool.getThreads() lines 56–206, getSysProps() lines 228–242
  • The JSP calls getSysInfo() on page load (line 2000) and getAllThreads() on button click (line 1894) — they are intentionally separate for performance (info is lightweight, dump is heavy)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in MaintenanceResource.java, then compare the legacy behavior in ThreadMonitorTool.getThreads() lines 56–206 and getSysProps() lines 228–242. Verify the two endpoints remain separate, expose the listed JVM thread and startup fields, honor hideSystem and deadlock detection, and enforce CMS Administrator and Maintenance portlet access.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.