apache/seatunnel · warning · InterruptedException

Thread interrupted

Error message

Thread interrupted

What it means

Db2Utils.skipReadAndSortSampleData samples column values for chunk splitting and checks Thread interruption inside the result loop. When the worker thread is interrupted (task cancelled or checkpoint/closure), it throws InterruptedException('Thread interrupted') to stop sampling promptly.

Source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-db2/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/db2/utils/Db2Utils.java:177

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

            stmt.setFetchSize(1024);
            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. No fix needed if you intentionally cancelled the job — this is expected cleanup
  2. If unexpected, check job manager logs for the original cancellation/shutdown cause
  3. Retry the job; sampling will restart
  4. Reduce table size or use non-sampling chunk strategy to shorten the interruption window
Defensive patterns

Strategy: try-catch

Try / catch

try { Db2Utils.skipReadAndSortSampleData(...); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); /* expected on cancel: exit sampling and restore interrupt flag */ }

Prevention

When it happens

Trigger: The task thread running sample-based split construction gets interrupted — job cancelled by user, pipeline stopped, or engine shutting down while sampling a large table.

Common situations: Cancelling a long-running incremental-snapshot job on a big DB2 table; engine failover/stop during the sampling phase; CLI Ctrl-C during job startup.

Related errors


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