{"record":{"id":"bbca5d336db0c479","repo":"apache/seatunnel","slug":"error-sink-worker-thread-did-not-terminate-within","errorCode":null,"errorMessage":"Error sink worker thread did not terminate within {} ms, interrupting it","messagePattern":"Error sink worker thread did not terminate within (.+?) ms, interrupting it","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/task/error/DefaultErrorSinkWriter.java","lineNumber":617,"sourceCode":"        }\n    }\n\n    private void waitForWorkerTermination(long timeoutMillis) {\n        if (workerThread == null) {\n            return;\n        }\n        if (!workerThread.isAlive()) {\n            return;\n        }\n        try {\n            workerThread.join(timeoutMillis);\n        } catch (InterruptedException e) {\n            Thread.currentThread().interrupt();\n            log.warn(\"Interrupted while waiting for error sink worker to close\");\n        }\n\n        if (workerThread.isAlive()) {\n            log.warn(\n                    \"Error sink worker thread did not terminate within {} ms, interrupting it\",\n                    timeoutMillis);\n            workerThread.interrupt();\n            try {\n                workerThread.join(Math.min(5_000L, timeoutMillis));\n            } catch (InterruptedException e) {\n                Thread.currentThread().interrupt();\n                log.warn(\n                        \"Interrupted while waiting for error sink worker to close after interrupt\");\n            }\n        }\n    }\n\n    private void waitForPendingRows(long timeoutMillis) throws Exception {\n        AtomicInteger currentPendingRows = this.pendingRows;\n        if (currentPendingRows == null) {\n            return;\n        }","sourceCodeStart":599,"sourceCodeEnd":635,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/task/error/DefaultErrorSinkWriter.java#L599-L635","documentation":"close() waits for the error-sink worker thread to finish. If the thread is still alive after the join timeout, this warning is logged and the thread is interrupt()ed, followed by a shorter (max 5s) grace join. It means the error sink writer could not drain/finish within the allotted time, usually because the error-sink backend is slow or blocked.","triggerScenarios":"workerThread.join(timeoutMillis) elapses with the thread alive — the worker is stuck in sinkWriter.write() or close() (e.g. blocking network I/O to the error sink, lock contention on writerLock, huge pending queue).","commonSituations":"Error-sink database latency spike or deadlock; error sink configured with very large flush intervals; error row rate far exceeds sink throughput so the queue never drains before close.","solutions":["Check error-sink backend health/latency at the time of the warning.","Increase the error-sink writer close/drain timeout so slow backends can finish.","Reduce error row volume (fix the upstream row errors) or increase error-sink parallelism/batch size.","If the worker is deadlocked in a connector, capture a thread dump and fix or upgrade that connector."],"exampleFix":"null","handlingStrategy":"retry","validationCode":"null","typeGuard":"null","tryCatchPattern":"// if you observe this warning, capture a thread dump of the worker before the interrupt escalates\nif (workerThread.isAlive()) {\n    threadDump(); // diagnose where write/close is blocked\n}","preventionTips":["Size error-sink throughput for peak error rates","Set realistic drain/close timeouts for slow backends","Alert on error-sink latency to catch degradation before close times out"],"tags":["timeout","threading","error-sink"],"backgroundTag":"operation-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"}