{"record":{"id":"7d4eaf2b57e4c444","repo":"apache/seatunnel","slug":"interrupted-while-waiting-for-error-sink-worker-to","errorCode":null,"errorMessage":"Interrupted while waiting for error sink worker to close","messagePattern":"Interrupted while waiting for error sink worker to close","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":613,"sourceCode":"            return true;\n        } catch (ReflectiveOperationException e) {\n            throw new RuntimeException(\n                    \"Failed to invoke \" + clazz.getName() + \".\" + methodName + \"()\", e);\n        }\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 {","sourceCodeStart":595,"sourceCodeEnd":631,"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#L595-L631","documentation":"During close(), DefaultErrorSinkWriter joins its error-sink worker thread with a timeout. If the joining thread is interrupted while waiting, the interrupt flag is restored and this warning is logged. The close sequence continues (it then checks whether the worker is still alive and may interrupt it), so this is a diagnostics warning rather than a thrown error.","triggerScenarios":"The task thread calling close() on the error sink writer receives an interrupt (task cancellation, job failover, engine shutdown) while blocked in workerThread.join(timeoutMillis).","commonSituations":"Job cancelled by user while error-sink queue is still draining; Zeta engine checkpoint/cancel racing with sink close; JVM shutdown hooks interrupting task threads.","solutions":["Check whether the job/task was intentionally cancelled — this warning is then expected and harmless.","If unexpected, look for upstream components issuing spurious interrupts (e.g. another timeout handler interrupting shared threads).","Reduce error-sink write latency or drain timeout so close completes before cancellation arrives."],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"// engine-internal warning; callers of close() should handle InterruptedException from their own thread pool\ntry {\n    errorSinkWriter.close();\n} catch (RuntimeException e) {\n    LOG.warn(\"error sink close did not finish cleanly\", e);\n}","preventionTips":["Avoid cancelling jobs mid-drain when possible; let close() finish","Keep error-sink queues small so drain completes quickly"],"tags":["threading","interruption","shutdown"],"backgroundTag":"thread-interrupted","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}