apache/seatunnel · info · InterruptedException
Interrupted while reading structure of schema
Error message
Interrupted while reading structure of schema
What it means
MySqlSnapshotChangeEventSource.readTableStructure iterates over the databases being snapshotted, emitting DROP DATABASE schema events and capturing CREATE DDL into the schema history. Before each database it checks whether the connector task is still running; if the task was cancelled, stopped, or its thread interrupted, it aborts the snapshot by throwing InterruptedException. This is a cooperative-cancellation signal, not a MySQL-side failure.
Source
Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/io/debezium/connector/mysql/MySqlSnapshotChangeEventSource.java:451
// Record default charset
addSchemaEvent(
snapshotContext,
"",
connection.setStatementFor(connection.readMySqlCharsetSystemVariables()));
for (TableId tableId : capturedSchemaTables) {
if (!sourceContext.isRunning()) {
throw new InterruptedException(
"Interrupted while emitting initial DROP TABLE events");
}
addSchemaEvent(
snapshotContext, tableId.catalog(), "DROP TABLE IF EXISTS " + quote(tableId));
}
final Map<String, DatabaseLocales> databaseCharsets = connection.readDatabaseCollations();
for (String database : databases) {
if (!sourceContext.isRunning()) {
throw new InterruptedException(
"Interrupted while reading structure of schema " + databases);
}
LOGGER.info("Reading structure of database '{}'", database);
addSchemaEvent(snapshotContext, database, "DROP DATABASE IF EXISTS " + quote(database));
final StringBuilder createDatabaseDddl =
new StringBuilder("CREATE DATABASE " + quote(database));
final DatabaseLocales defaultDatabaseLocales = databaseCharsets.get(database);
if (defaultDatabaseLocales != null) {
defaultDatabaseLocales.appendToDdlStatement(database, createDatabaseDddl);
}
addSchemaEvent(snapshotContext, database, createDatabaseDddl.toString());
addSchemaEvent(snapshotContext, database, "USE " + quote(database));
createSchemaEventsForTables(snapshotContext, tablesToRead.get(database), true);
}
}
View on GitHub (pinned to cf67b549a7)
Solutions
- No fix needed if the cancellation was intentional: the snapshot will resume or restart on the next task start.
- If it fires unexpectedly, check the Zeta/connector logs just before this line for an explicit cancel, stop, or failover event to find who interrupted the task.
- Reduce snapshot duration (e.g. snapshot on a replica, smaller table.changelog set, snapshot.max.threads tuning) so fewer interruptions land mid-schema-read.
- If it happens repeatedly at the same point, verify MySQL connectivity/stability so the schema read completes quickly instead of hanging until a stop arrives.
Defensive patterns
Strategy: try-catch
Validate before calling
// before submitting the CDC job
if (!mysqlReachable(host, port, user, password)) {
throw new IllegalStateException("MySQL unreachable; snapshot would stall and risk interruption");
} Try / catch
try {
executeCdcJob(config);
} catch (InterruptedException e) {
Thread.currentThread().interrupt(); // preserve interrupt status
log.info("Snapshot cancelled at {} — will resume on restart", e.getMessage());
} Prevention
- Avoid cancelling jobs during first snapshots; schedule stops between snapshots
- Keep snapshots short (fewer tables, replica-based snapshot)
- Monitor snapshot progress so cancellations are deliberate
- Ensure the engine's task thread is not spuriously interrupted by checkpoint timeouts
When it happens
Trigger: The snapshot loop calls sourceContext.isRunning() before processing each database and the flag has flipped to false (or the thread's interrupt flag was set), typically because the job was cancelled by the engine, the connector task was stopped/restarted, or a shutdown/interrupt was delivered to the snapshot thread mid-readTableStructure.
Common situations: Cancelling a SeaTunnel Zeta job while a large snapshot is in progress; connector task restart or failover during schema capture; `snapshot.locking.mode` or long schema reads making the window where a stop can land very large; operator redeploys while a first snapshot runs.
Related errors
- Interrupted while processing event
- Failed to get connection, interrupted while doing another at
- Interrupted while emitting initial DROP TABLE events
- Snapshot was interrupted before completion
- Snapshot was interrupted before completion
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/312e9452dfaedeb8.
Report an issue: GitHub.