apache/seatunnel · warning

Interrupted while waiting for error sink worker to close aft

Error message

Interrupted while waiting for error sink worker to close after interrupt

What it means

After the first join times out, close() interrupts the error-sink worker thread and joins again for up to 5 seconds. If that second join is itself interrupted, the interrupt flag is restored and this warning is logged. This is a nested-shutdown diagnostics warning indicating heavy contention on the closing thread's interrupt status.

Source

Thrown at seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/task/error/DefaultErrorSinkWriter.java:625

            return;
        }
        try {
            workerThread.join(timeoutMillis);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            log.warn("Interrupted while waiting for error sink worker to close");
        }

        if (workerThread.isAlive()) {
            log.warn(
                    "Error sink worker thread did not terminate within {} ms, interrupting it",
                    timeoutMillis);
            workerThread.interrupt();
            try {
                workerThread.join(Math.min(5_000L, timeoutMillis));
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
                log.warn(
                        "Interrupted while waiting for error sink worker to close after interrupt");
            }
        }
    }

    private void waitForPendingRows(long timeoutMillis) throws Exception {
        AtomicInteger currentPendingRows = this.pendingRows;
        if (currentPendingRows == null) {
            return;
        }
        long deadline = System.currentTimeMillis() + timeoutMillis;
        while (currentPendingRows.get() > 0) {
            throwWorkerFailureIfAny();
            if (System.currentTimeMillis() >= deadline) {
                throw new RuntimeException(
                        String.format(
                                "Timed out waiting for error sink queue to drain. jobId=%d, pluginName=%s, pendingRows=%d",
                                jobId, sinkConfig.getPluginName(), currentPendingRows.get()));

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Treat as benign if the job was being cancelled or the engine shut down.
  2. If recurring in normal operation, audit code that interrupts task threads (retry/cancel logic) to avoid double interrupts.
  3. Ensure error-sink worker finishes quickly so close() doesn't need the interrupt path at all.

Example fix

null
Defensive patterns

Strategy: try-catch

Validate before calling

null

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: A second interrupt arrives on the closing thread while it waits in workerThread.join(min(5000, timeoutMillis)) after having interrupted the worker — typically aggressive task cancellation or engine shutdown racing sink close.

Common situations: Job kill/failover storm interrupting all task threads repeatedly; engine shutdown hooks firing while close() is still in progress.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/7ce1372ba227609f. Report an issue: GitHub.