{"record":{"id":"1e12e3c008b1a850","repo":"apache/iceberg","slug":"interrupted-in-call-to-initialize-1e12e3","errorCode":null,"errorMessage":"Interrupted in call to initialize","messagePattern":"Interrupted in call to initialize","errorType":"exception","errorClass":"UncheckedInterruptedException","httpStatus":null,"severity":"info","filePath":"flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/maintenance/api/JdbcLockFactory.java","lineNumber":158,"sourceCode":"            }\n            LOG.info(\"Creating Flink maintenance lock table {}\", LOCK_TABLE_NAME);\n            try (PreparedStatement ps = conn.prepareStatement(CREATE_LOCK_TABLE_SQL)) {\n              ps.execute();\n            }\n\n            return true;\n          });\n    } catch (SQLTimeoutException e) {\n      throw new UncheckedSQLException(\n          e, \"Cannot initialize JDBC table maintenance lock: Query timed out\");\n    } catch (SQLTransientConnectionException | SQLNonTransientConnectionException e) {\n      throw new UncheckedSQLException(\n          e, \"Cannot initialize JDBC table maintenance lock: Connection failed\");\n    } catch (SQLException e) {\n      throw new UncheckedSQLException(e, \"Cannot initialize JDBC table maintenance lock\");\n    } catch (InterruptedException e) {\n      Thread.currentThread().interrupt();\n      throw new UncheckedInterruptedException(e, \"Interrupted in call to initialize\");\n    }\n  }\n\n  private static class JdbcLock implements TriggerLockFactory.Lock {\n    private final JdbcClientPool pool;\n    private final String lockId;\n    private final Type type;\n\n    private JdbcLock(JdbcClientPool pool, String lockId, Type type) {\n      this.pool = pool;\n      this.lockId = lockId;\n      this.type = type;\n    }\n\n    @Override\n    public boolean tryLock() {\n      if (isHeld()) {\n        LOG.info(\"Lock is already held for {}\", this);","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/maintenance/api/JdbcLockFactory.java#L140-L176","documentation":"Thrown by JdbcLockFactory.initializeLockTables when the thread is interrupted while waiting for the JDBC connection pool to initialize or execute the lock-table DDL. The library restores the interrupt flag and wraps the InterruptedException in UncheckedInterruptedException. It signals the task/operator is being shut down rather than a database problem.","triggerScenarios":"The Flink taskmanager operator (open) is cancelled or fails while initializeLockTables is blocked acquiring a pooled connection or running CREATE TABLE; job restart/cancel during startup.","commonSituations":"Job cancellation or savepoint restart while the maintenance operator is initializing; slow database startup causing the operator to be interrupted mid-init; Flink shutdown timeouts.","solutions":["No code fix needed if this happened during intentional job cancellation — it is expected shutdown behavior","If it occurs repeatedly on startup, check Flink task restart policies and operator open() timeouts","Verify the database is reachable and fast enough so initialization completes before cancellation","Inspect logs for the interrupt source (task cancel, failover) rather than the database itself"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  lockFactory.create();\n} catch (UncheckedInterruptedException e) {\n  Thread.currentThread().interrupt();\n  // expected during job cancellation; propagate or abort cleanly\n}","preventionTips":["Avoid cancelling jobs during the maintenance operator's open() phase when possible","Keep DB initialization fast (low-latency network to the lock database)","Set sensible Flink restart strategies so re-init after interruption is clean"],"tags":["interrupted","flink","jdbc","shutdown","threading"],"backgroundTag":"operation-interrupted","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}