apache/seatunnel · warning · InterruptedException
Thread interrupted
Error message
Thread interrupted
What it means
MySqlUtils.skipReadAndSortSampleData samples a column's values during chunk planning and throws InterruptedException when it detects Thread.currentThread().isInterrupted() mid-scan. The library throws this to abort long sampling scans promptly when the task is being cancelled or the checkpoint/job is stopping, preserving interruption semantics.
Source
Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/utils/MySqlUtils.java:171
stmt =
jdbc.connection()
.createStatement(
ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
stmt.setFetchSize(Integer.MIN_VALUE);
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
- This is usually an intentional cancellation — confirm whether the job was cancelled and simply restart it if the cancel was unintended
- For very large tables, tune chunk size / sampling rate so planning finishes faster and is less likely to be cancelled
- Check checkpoint timeout settings; raise them if long sampling trips checkpoint timeouts that trigger cancellation
- Ensure the thread interrupt isn't caused by a shutdown hook or watchdog; inspect worker logs at cancellation time
Defensive patterns
Strategy: try-catch
Try / catch
try {
List<Object> samples = MySqlUtils.skipReadAndSortSampleData(jdbc, tableId, col, rate, rows);
} catch (InterruptedException e) {
Thread.currentThread().interrupt(); // restore flag before returning/cancelling
} Prevention
- Tune sampling rate/chunk size for large tables so planning completes quickly
- Raise checkpoint timeout if sampling trips cancellations
- Don't cancel jobs unless intended; interrupts are the designed abort path
- Monitor worker restarts that interrupt in-flight sampling
When it happens
Trigger: Calling skipReadAndSortSampleData when the snapshot task thread is interrupted: job cancelled via REST/CLI, checkpoint timeout leading to task cancel, or engine shutdown during the sampling scan of a large table.
Common situations: User cancels a slow snapshot job; sampling a very large table takes so long that the engine cancels the task; worker shutdown/restart; manual kill of the job while sampling is in progress.
Related errors
- Interrupted while emitting initial DROP TABLE events
- Thread interrupted
- Thread interrupted
- Thread interrupted
- Thread interrupted
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/10db1d6a026f0e25.
Report an issue: GitHub.