{"record":{"id":"1134c7e40e5e4213","repo":"apache/seatunnel","slug":"get-running-jobs-slow-full-costms","errorCode":null,"errorMessage":"GET /running-jobs slow: full={} costMs={}","messagePattern":"GET /running-jobs slow: full=(.+?) costMs=(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/servlet/RunningJobsServlet.java","lineNumber":87,"sourceCode":"                        ? jobInfoService.getRunningJobsJson()\n                        : jobInfoService.getRunningJobsSummaryJson();\n\n        long costMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNs);\n        long dispatchDelayMs = receivedMs <= 0 ? -1 : Math.max(0, nowMs - receivedMs);\n\n        resp.setHeader(\"X-Dispatch-Delay-Ms\", String.valueOf(dispatchDelayMs));\n        resp.setHeader(\"X-Handler-Cost-Ms\", String.valueOf(costMs));\n\n        writeJsonWithPagination(req, resp, runningJobs);\n\n        if (dispatchDelayMs > 500) {\n            log.warn(\n                    \"GET /running-jobs dispatch delayed: dispatchDelayMs={} thread={}\",\n                    dispatchDelayMs,\n                    Thread.currentThread().getName());\n        }\n        if (costMs > 500) {\n            log.warn(\"GET /running-jobs slow: full={} costMs={}\", full, costMs);\n            Runtime rt = Runtime.getRuntime();\n            long usedBytes = rt.totalMemory() - rt.freeMemory();\n            log.warn(\n                    \"GET /running-jobs slow diagnostics: full={} costMs={} thread={} \"\n                            + \"heapUsedMB={} heapTotalMB={} heapMaxMB={}\",\n                    full,\n                    costMs,\n                    Thread.currentThread().getName(),\n                    usedBytes / 1024 / 1024,\n                    rt.totalMemory() / 1024 / 1024,\n                    rt.maxMemory() / 1024 / 1024);\n        } else {\n            log.debug(\"GET /running-jobs: full={} costMs={}\", full, costMs);\n        }\n    }\n}\n","sourceCodeStart":69,"sourceCodeEnd":104,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/servlet/RunningJobsServlet.java#L69-L104","documentation":"RunningJobsServlet.doGet logs this when the GET /running-jobs handler took more than 500ms to execute. `full` indicates whether the response was a full (unpaginated) listing; the companion diagnostics line adds heap stats.","triggerScenarios":"Requesting the full (non-paginated) /running-jobs listing on a cluster with many running jobs, causing long serialization/collection time over 500ms.","commonSituations":"Large clusters without pagination; dashboards fetching the full job list every few seconds; coordinator under memory/GC pressure while aggregating job statuses.","solutions":["Use pagination query parameters instead of full=true when consuming /running-jobs","Reduce number of concurrently running jobs or scale the cluster","Increase node JVM heap if diagnostics show heap pressure","Cache the job list on the client side and poll less often"],"exampleFix":"// before\nGET /running-jobs?full=true\n// after\nGET /running-jobs?page=1&pageSize=20","handlingStrategy":"fallback","validationCode":"// prefer paginated call unless the job count is small\nconst useFull = knownJobCount < 50;\nconst url = useFull ? baseUrl + '/running-jobs?full=true' : baseUrl + '/running-jobs?page=1&pageSize=20';","typeGuard":null,"tryCatchPattern":"try {\n  const resp = await fetch(url);\n  const cost = Number(resp.headers.get('X-Handler-Cost-Ms') || 0);\n  if (cost > 500) switchToPaginatedPolling();\n} catch (e) { /* fall back to cached last-known list */ }","preventionTips":["Avoid full=true on large clusters; paginate instead","Cache job lists client-side between polls","Keep running job count within cluster capacity","Monitor X-Handler-Cost-Ms and adapt polling strategy dynamically"],"tags":["performance","rest-api","pagination"],"backgroundTag":"request-timeout","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}