apache/seatunnel · warning · InterruptedException

Thread interrupted

Error message

Thread interrupted

What it means

Thrown by OracleUtils.skipReadAndSortSampleData when the sampling thread detects it has been interrupted (Thread.interrupted()). It is an InterruptedException used to abort long-running sample-data reads promptly during snapshot cancellation or task shutdown.

Source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-oracle/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/oracle/utils/OracleUtils.java:196

            stmt =
                    jdbc.connection()
                            .createStatement(
                                    ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);

            stmt.setFetchSize(DEFAULT_FETCH_SIZE);
            rs = stmt.executeQuery(sampleQuery);

            int count = 0;
            while (rs.next()) {
                count++;
                if (count % 100000 == 0) {
                    log.info("Processing row index: {}", count);
                }
                if (count % inverseSamplingRate == 0) {
                    results.add(rs.getObject(1));
                }
                if (Thread.currentThread().isInterrupted()) {
                    throw new InterruptedException("Thread interrupted");
                }
            }
        } finally {
            if (rs != null) {
                try {
                    rs.close();
                } catch (SQLException e) {
                    log.error("Failed to close ResultSet", e);
                }
            }
            if (stmt != null) {
                try {
                    stmt.close();
                } catch (SQLException e) {
                    log.error("Failed to close Statement", e);
                }
            }
        }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Treat as expected during cancellation: rerun/restart the job; snapshot will retry.
  2. If it happens repeatedly at start, check for frequent task restarts (OOM, checkpoint timeouts) and fix the root cause.
  3. Reduce sampling cost on very large tables (adjust sampling rate/inverseSamplingRate) so the phase finishes faster.
  4. Check job manager logs for the initiating cancel/interrupt to identify the upstream failure.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    OracleUtils.skipReadAndSortSampleData(jdbc, tableId, columnName, ...);
} catch (InterruptedException e) {
    Thread.currentThread().interrupt(); // restore flag
    LOG.info("sampling aborted due to task cancellation");
    return Collections.emptyList();
}

Prevention

When it happens

Trigger: The snapshot task is cancelled/fails over while the sampler is streaming and sorting sampled rows; Zeta/Flink sends an interrupt to stop the task; job restart or checkpoint timeout leads to task interruption during the sampling loop.

Common situations: Job cancelled by user; worker node failure triggering task restart; slow sampling of huge tables making interruption likely during shutdown; checkpoint timeout aborting the task mid-sample.

Related errors


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