{"record":{"id":"c58c9bea0fc3b081","repo":"apache/iceberg","slug":"interrupted-in-call-to-initialize-c58c9b","errorCode":null,"errorMessage":"Interrupted in call to initialize","messagePattern":"Interrupted in call to initialize","errorType":"exception","errorClass":"UncheckedInterruptedException","httpStatus":null,"severity":"warning","filePath":"flink/v2.2/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.2/flink/src/main/java/org/apache/iceberg/flink/maintenance/api/JdbcLockFactory.java#L140-L176","documentation":"If the thread calling JdbcLockFactory.initializeLockTables is interrupted while executing SQL (Tasks retries/pool waiting), the InterruptedException is handled by re-interrupting the thread and throwing UncheckedInterruptedException with this message. It signals the operator/task was cancelled or shutting down during lock initialization.","triggerScenarios":"JdbcLockFactory.create/open -> initializeLockTables while the enclosing Flink task/operator is cancelled or failed, or the thread is interrupted during the JDBC pool call.","commonSituations":"Job cancellation/restart during operator open, Flink failover, or shutdown while the DB call is slow (making the interruption window likely).","solutions":["No code fix needed if caused by intentional job cancellation; the interrupt flag is properly restored.","If unexpected, check job manager logs for the cancellation/failure that triggered the interrupt.","Reduce time spent in initializeLockTables (pre-create lock tables) to narrow the interruption window.","Re-run the job once the cancellation cause is resolved."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  lockFactory.open();\n} catch (UncheckedInterruptedException e) {\n  // thread interrupt flag already restored; treat as cancellation\n  throw e; // or return cleanly if shutdown was expected\n}","preventionTips":["Expect this during job cancellation; don't suppress it","Pre-create lock tables so open() completes quickly","Check job logs for the originating cancellation/failure"],"tags":["interrupt","jdbc","cancellation","lock"],"backgroundTag":"invalid-state-transition","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}