[TASK] Implement thread dump and info endpoints
A pull request for this has already been merged.
- #35463 by @hassandotcms — merged
- 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
deadlockedboolean flag based onThreadMXBean.findDeadlockedThreads() - API caller must be able to filter system threads via
hideSystemquery param (default true) — when true, only threads withcom.dotmarketingorcom.dotcmsin 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 twotrueparams request locked monitors and locked synchronizers - Deadlock detection:
ThreadMXBean.findDeadlockedThreads()returns array of thread IDs (or null) - Thread counts:
ThreadMXBean.getThreadCount()andgetPeakThreadCount() - Startup time:
ManagementFactory.getRuntimeMXBean().getStartTime() - The DWR version uses reflection to get the internal
eetopfield 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) andgetAllThreads()on button click (line 1894) — they are intentionally separate for performance (info is lightweight, dump is heavy)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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