{"record":{"id":"a43a670d52588eff","repo":"apache/iceberg","slug":"interrupted-during-commit-a43a67","errorCode":null,"errorMessage":"Interrupted during commit","messagePattern":"Interrupted during commit","errorType":"exception","errorClass":"UncheckedInterruptedException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/jdbc/JdbcViewOperations.java","lineNumber":134,"sourceCode":"    } catch (SQLTransientConnectionException | SQLNonTransientConnectionException e) {\n      throw new UncheckedSQLException(e, \"Database Connection failed\");\n    } catch (DataTruncation e) {\n      throw new UncheckedSQLException(e, \"Database data truncation error\");\n    } catch (SQLWarning e) {\n      throw new UncheckedSQLException(e, \"Database warning\");\n    } catch (SQLException e) {\n      if (JdbcUtil.isConstraintViolation(e)) {\n        if (currentMetadataLocation() == null) {\n          throw new AlreadyExistsException(e, \"View already exists: %s\", viewIdentifier);\n        } else {\n          throw new UncheckedSQLException(e, \"View already exists: %s\", viewIdentifier);\n        }\n      }\n\n      throw new UncheckedSQLException(e, \"Unknown failure\");\n    } catch (InterruptedException e) {\n      Thread.currentThread().interrupt();\n      throw new UncheckedInterruptedException(e, \"Interrupted during commit\");\n    }\n  }\n\n  @Override\n  protected String viewName() {\n    return viewIdentifier.toString();\n  }\n\n  @Override\n  protected FileIO io() {\n    return fileIO;\n  }\n\n  private void validateMetadataLocation(Map<String, String> view, ViewMetadata base) {\n    String catalogMetadataLocation = view.get(JdbcTableOperations.METADATA_LOCATION_PROP);\n    String baseMetadataLocation = base != null ? base.metadataFileLocation() : null;\n\n    if (!Objects.equals(baseMetadataLocation, catalogMetadataLocation)) {","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/jdbc/JdbcViewOperations.java#L116-L152","documentation":"doCommit catches InterruptedException thrown while waiting on the connection pool / commit execution and rethrows it as UncheckedInterruptedException('Interrupted during commit') after restoring the thread's interrupt flag. This signals the commit did not complete because the calling thread was interrupted, and it propagates the interruption politely.","triggerScenarios":"The thread performing JdbcViewOperations.commit() (which internally uses connectionPool ConnectionProvider and can block acquiring connections or executing SQL) is interrupted — e.g. query/task cancellation, executor shutdown, or a timeout mechanism that interrupts worker threads.","commonSituations":"Spark/Flink task cancellation mid-commit; application shutdown while a view commit is in flight; a wrapper setting a thread timeout and calling Future.cancel(true).","solutions":["Treat the commit as not applied and re-plan; check the catalog to see whether the view metadata was actually written before retrying","Propagate or handle the interruption rather than swallowing it — the interrupt flag is already restored by the library","Avoid interrupting threads that are in the middle of catalog commits; use cancellation points outside commit","Retry the commit after shutdown/cancellation resolves, since JDBC commit is atomic via conditional UPDATE","Investigate what issued the interrupt (executor shutdown, cancel(true)) and fix the lifecycle"],"exampleFix":"// before\nexecutor.submit(() -> viewOps.commit(req)); // cancelled via future.cancel(true)\n// after: let commits finish or check state before retry\nboolean done = future.await(30, TimeUnit.SECONDS);\nif (!done) {\n  // verify catalog state before re-committing\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  viewOps.commit(request);\n} catch (UncheckedInterruptedException e) {\n  // interrupt flag already restored by the library\n  Thread.currentThread().interrupt();\n  throw new CommitAbortedException(viewId, e);\n}","preventionTips":["Do not interrupt threads mid-commit; cancel at safe points instead","Use shutdown hooks that let in-flight commits finish or verify catalog state after","After interruption, re-read the view to determine if the commit landed before retrying"],"tags":["jdbc","interruption","threading","catalog-commit"],"backgroundTag":"request-timeout","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"}