Skip to content

[TASK] Implement thread dump and info endpoints #35205

@hassandotcms

Description

@hassandotcms

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions