apache/seatunnel · warning

Interrupted while waiting for error sink worker to close

Error message

Interrupted while waiting for error sink worker to close

What it means

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.

Source

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

            return true;
        } catch (ReflectiveOperationException e) {
            throw new RuntimeException(
                    "Failed to invoke " + clazz.getName() + "." + methodName + "()", e);
        }
    }

    private void waitForWorkerTermination(long timeoutMillis) {
        if (workerThread == null) {
            return;
        }
        if (!workerThread.isAlive()) {
            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 {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Check whether the job/task was intentionally cancelled — this warning is then expected and harmless.
  2. If unexpected, look for upstream components issuing spurious interrupts (e.g. another timeout handler interrupting shared threads).
  3. Reduce error-sink write latency or drain timeout so close completes before cancellation arrives.

Example fix

null
Defensive patterns

Strategy: try-catch

Validate before calling

null

Type guard

null

Try / catch

// engine-internal warning; callers of close() should handle InterruptedException from their own thread pool
try {
    errorSinkWriter.close();
} catch (RuntimeException e) {
    LOG.warn("error sink close did not finish cleanly", e);
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


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