{"record":{"id":"05ee6eb418713472","repo":"apache/seatunnel","slug":"caller-calleraddress-cannot-get-taskgrouplocati","errorCode":null,"errorMessage":"Caller ${callerAddress} cannot get taskGroupLocation metrics${taskGroupLocations} because it is not master. Master is: ${masterAddress}","messagePattern":"Caller (.+?) cannot get taskGroupLocation metrics(.+?) because it is not master\\. Master is: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/task/operation/GetTaskGroupMetricsOperation.java","lineNumber":57,"sourceCode":"    private List<TaskGroupLocation> taskGroupLocations;\n    private RawJobMetrics response;\n\n    public GetTaskGroupMetricsOperation() {}\n\n    public GetTaskGroupMetricsOperation(List<TaskGroupLocation> taskGroupLocations) {\n        this.taskGroupLocations = taskGroupLocations;\n    }\n\n    @Override\n    public void run() {\n        ILogger logger = getLogger();\n\n        Address callerAddress = getCallerAddress();\n\n        NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();\n        Address masterAddress = getNodeEngine().getMasterAddress();\n        if (!callerAddress.equals(masterAddress)) {\n            throw new IllegalStateException(\n                    \"Caller \"\n                            + callerAddress\n                            + \" cannot get taskGroupLocation metrics\"\n                            + taskGroupLocations.toString()\n                            + \" because it is not master. Master is: \"\n                            + masterAddress);\n        }\n\n        JobMetricsCollector metricsRenderer =\n                new JobMetricsCollector(taskGroupLocations, nodeEngine.getLocalMember(), logger);\n        nodeEngine.getMetricsRegistry().collect(metricsRenderer);\n        response = metricsRenderer.getMetrics();\n    }\n\n    @Override\n    protected void writeInternal(ObjectDataOutput out) throws IOException {\n        super.writeInternal(out);\n        out.writeInt(taskGroupLocations.size());","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/task/operation/GetTaskGroupMetricsOperation.java#L39-L75","documentation":"GetTaskGroupMetricsOperation.run() lets the master fetch per-task-group metrics from workers. If the caller address is not the current master address, it throws IllegalStateException naming the caller, requested taskGroupLocations, and the real master — enforcing master-only access to this operation.","triggerScenarios":"run() executes on a worker receiving GetTaskGroupMetricsOperation from an address != getNodeEngine().getMasterAddress(); typical when a stale or duplicate master queries metrics, or a non-master node issues the operation.","commonSituations":"Master failover leaving the previous master still polling workers; split-brain clusters with two masters; misconfigured cluster where an operator tool mimics master behavior from a worker.","solutions":["Verify cluster membership and that exactly one master exists (fix split-brain: same cluster name, proper discovery).","After failover, let the new master re-initiate metric pulls; discard requests from the old master.","Update any custom monitoring code to target/execute from the current master only.","Restart nodes with inconsistent membership lists to rejoin cleanly."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!nodeEngine.getMasterAddress().equals(callerAddress)) { throw new IllegalStateException(\"metrics pull restricted to master\"); }","typeGuard":null,"tryCatchPattern":"try { pullTaskGroupMetrics(groups); } catch (IllegalStateException e) { if (e.getMessage().contains(\"because it is not master\")) { rescheduleOnCurrentMaster(); } else { throw e; } }","preventionTips":["Ensure a single master after failover (proper quorum/discovery)","Disable stale-master polling loops","Run monitoring through the master's public API"],"tags":["cluster","metrics","master-election","authorization"],"backgroundTag":"insufficient-permissions","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}