{"record":{"id":"6b628ce4177485d5","repo":"apache/seatunnel","slug":"task-init-is-not-complete-try-to-get-it-again-aft","errorCode":null,"errorMessage":"Task init is not complete, try to get it again after 200 ms","messagePattern":"Task init is not complete, try to get it again after 200 ms","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/task/SourceSplitEnumeratorTask.java","lineNumber":288,"sourceCode":"\n    public TaskLocation getTaskMemberLocation(long taskID) {\n        return taskIDToTaskLocationMapping.get(taskID);\n    }\n\n    public Address getTaskMemberAddressByIndex(int taskIndex) {\n        return taskMemberMapping.get(taskIndexToTaskLocationMapping.get(taskIndex));\n    }\n\n    public TaskLocation getTaskMemberLocationByIndex(int taskIndex) {\n        return taskIndexToTaskLocationMapping.get(taskIndex);\n    }\n\n    private SourceSplitEnumerator<SplitT, Serializable> getEnumerator()\n            throws InterruptedException, ExecutionException {\n        // (restoreComplete == null) means that the Task has not yet executed Init, so we need to\n        // wait.\n        while (null == restoreComplete) {\n            log.warn(\"Task init is not complete, try to get it again after 200 ms\");\n            Thread.sleep(200);\n        }\n        restoreComplete.get();\n        return enumerator;\n    }\n\n    public void readerFinished(TaskLocation taskLocation) {\n        unfinishedReaders.remove(taskLocation.getTaskID());\n        if (unfinishedReaders.isEmpty()) {\n            prepareCloseStatus = true;\n        } else if (Boundedness.UNBOUNDED.equals(this.source.getSource().getBoundedness())) {\n            log.info(\n                    \"Send close idle reader {} operation of unbounded job. {}\",\n                    taskLocation.getTaskIndex(),\n                    taskLocation);\n            this.getExecutionContext()\n                    .sendToMaster(new CloseIdleReaderOperation(jobID, taskLocation))\n                    .join();","sourceCodeStart":270,"sourceCodeEnd":306,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/task/SourceSplitEnumeratorTask.java#L270-L306","documentation":"SourceSplitEnumeratorTask.getEnumerator() blocks until the task's asynchronous initialization (restoreComplete future) is created. If a caller asks for the enumerator before Init has run, it logs this warning and sleeps 200ms in a loop until init completes.","triggerScenarios":"Any early call path touching the enumerator — getSplitSerializer, addSplitsBack, requestSplit, handleSourceEvent, notifyCheckpointComplete — arriving before the task executed init(), e.g. a split request or source event racing task startup after restore/recovery.","commonSituations":"Job recovery/failover where the coordinator sends split requests or checkpoint notifications before the restarted task finishes initialization; slow connector init (network to broker/DB) while the engine already issues requests.","solutions":["Usually self-healing — the task completes init and proceeds; no action needed if transient","If it loops indefinitely, check the task's init failure in logs (an exception in init will leave restoreComplete unset)","Reduce slow init causes: verify source connectivity (DB/broker) and credentials so init completes quickly","Upgrade SeaTunnel if recurring races are seen in your version"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// ensure init can finish fast by pre-checking source connectivity\n// before submitting: verify DB/broker reachable\nnc -z <source-host> <source-port> || echo 'source unreachable: init will be slow'","typeGuard":null,"tryCatchPattern":"// the engine-side loop is built in; operators should watch for it repeating\nif (logLines.filter(l => l.contains('Task init is not complete')).length > 50) {\n  investigateSourceInitialization();\n}","preventionTips":["Verify source system reachability and credentials so task init completes quickly","Avoid hammering the job with split/checkpoint requests during recovery; give tasks time to init","Monitor this warning's frequency — a long-running loop indicates a stuck init","Keep SeaTunnel updated; init/task startup races are fixed over time"],"tags":["source-connector","initialization","race-condition","zeta"],"backgroundTag":"invalid-state-transition","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"}