apache/seatunnel · warning · InterruptedException

Thread interrupted

Error message

Thread interrupted

What it means

Thrown by YashanDbDialect.sampleDataFromColumn when the sampling loop detects the worker thread has been interrupted while streaming sampled values from the split column. Sampling is aborted via InterruptedException so the framework can shut the task down cleanly.

Solutions

  1. No fix needed — this is a cooperative cancellation; re-run the job if the cancel was unintentional
  2. Speed up sampling by reducing sampling rate or adding a WHERE filter on the split column so it finishes before timeouts
  3. Increase job/task timeout settings if sampling on very large tables is legitimately slow
  4. Avoid frequent manual cancellations during split computation
Defensive patterns

Strategy: retry

Validate before calling

// No pre-check possible; instead ensure generous timeouts so sampling completes
// and avoid cancelling during split computation

Try / catch

try {
    runJob();
} catch (InterruptedException e) {
    Thread.currentThread().interrupt(); // preserve interrupt status and re-run if needed
} catch (Exception e) {
    if (e.getCause() instanceof InterruptedException) { /* job was cancelled during sampling */ }
}

Prevention

When it happens

Trigger: A job cancel, checkpoint/timeout, or task failure interrupts the thread while ResultSet iteration over the sampling query is in progress.

Common situations: User cancels a job during the split-sampling phase; coordinator timeout interrupts slow sampling on large tables; worker shutdown/restart.

Related errors


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

Appendix: source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/yashandb/YashanDbDialect.java:330

        } else {
            sampleQuery =
                    String.format(
                            "SELECT %s FROM %s",
                            quoteIdentifier(columnName), tableIdentifier(table.getTablePath()));
        }

        try (PreparedStatement stmt = creatPreparedStatement(connection, sampleQuery, fetchSize)) {
            try (ResultSet rs = stmt.executeQuery()) {
                int count = 0;
                List<Object> results = new ArrayList<>();

                while (rs.next()) {
                    count++;
                    if (count % samplingRate == 0) {
                        results.add(rs.getObject(1));
                    }
                    if (Thread.currentThread().isInterrupted()) {
                        throw new InterruptedException("Thread interrupted");
                    }
                }
                Object[] resultsArray = results.toArray();
                Arrays.sort(resultsArray);
                return resultsArray;
            }
        }
    }

    @Override
    public void applySchemaChange(
            Connection connection, TablePath tablePath, AlterTableAddColumnEvent event)
            throws SQLException {
        List<String> ddlSQL = new ArrayList<>();
        ddlSQL.add(buildUpdateColumnSQL(connection, tablePath, event));

        if (event.getColumn().getComment() != null) {
            ddlSQL.add(buildUpdateColumnCommentSQL(tablePath, event.getColumn()));

View on GitHub (pinned to cf67b549a7)