apache/seatunnel · warning · InterruptedException

Thread interrupted

Error message

Thread interrupted

What it means

OceanBaseMysqlDialect.sampleDataFromColumn iterates sampled column values and throws InterruptedException as soon as the worker thread's interrupt flag is set, aborting split-boundary sampling for cooperative cancellation. Like its MySQL counterpart, this is an expected cancellation signal rather than a data/query failure.

Source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/oceanbase/OceanBaseMysqlDialect.java:185

                            "SELECT %s FROM %s",
                            quoteIdentifier(columnName), tableIdentifier(table.getTablePath()));
        }

        try (Statement stmt =
                connection.createStatement(
                        ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)) {
            stmt.setFetchSize(Integer.MIN_VALUE);
            try (ResultSet rs = stmt.executeQuery(sampleQuery)) {
                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 Long approximateRowCntStatement(Connection connection, JdbcSourceTable table)
            throws SQLException {

        // 1. If no query is configured, use TABLE STATUS.
        // 2. If a query is configured but does not contain a WHERE clause and tablePath is
        // configured , use TABLE STATUS.
        // 3. If a query is configured with a WHERE clause, or a query statement is configured but
        // tablePath is TablePath.DEFAULT, use COUNT(*).

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Ignore if it coincides with an intentional job cancel/stop.
  2. Hunt for upstream code swallowing InterruptedException without restoring the interrupt flag if it appears spuriously.
  3. Increase samplingRate or bound the sample query to make interruption fast and reduce cancellation races.
  4. In wrapping code, re-interrupt the thread and propagate instead of silently retrying.
Defensive patterns

Strategy: try-catch

Try / catch

try { dialect.sampleDataFromColumn(...); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException("Sampling interrupted", e); }

Prevention

When it happens

Trigger: The sampling ResultSet loop in sampleDataFromColumn observes Thread.currentThread().isInterrupted() — raised when SeaTunnel cancels/interrupts the task during job stop, failover, or shutdown while enumerating splits on an OceanBase (MySQL-mode) table.

Common situations: Cancelling a job mid split-enumeration on large OceanBase tables; checkpoint timeout triggering task interruption; application shutdown interrupting worker threads.

Related errors


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