{"record":{"id":"e06167f8fbc6f4a0","repo":"apache/iceberg","slug":"interrupted-during-refresh-e06167","errorCode":null,"errorMessage":"Interrupted during refresh","messagePattern":"Interrupted during refresh","errorType":"exception","errorClass":"UncheckedInterruptedException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/jdbc/JdbcViewOperations.java","lineNumber":74,"sourceCode":"      String catalogName,\n      TableIdentifier viewIdentifier,\n      Map<String, String> catalogProperties) {\n    this.catalogName = catalogName;\n    this.viewIdentifier = viewIdentifier;\n    this.fileIO = fileIO;\n    this.connections = dbConnPool;\n    this.catalogProperties = catalogProperties;\n  }\n\n  @Override\n  protected void doRefresh() {\n    Map<String, String> view;\n\n    try {\n      view = JdbcUtil.loadView(JdbcUtil.SchemaVersion.V1, connections, catalogName, viewIdentifier);\n    } catch (InterruptedException e) {\n      Thread.currentThread().interrupt();\n      throw new UncheckedInterruptedException(e, \"Interrupted during refresh\");\n    } catch (SQLException e) {\n      // SQL exception happened when getting view from catalog\n      throw new UncheckedSQLException(\n          e, \"Failed to get view %s from catalog %s\", viewIdentifier, catalogName);\n    }\n\n    if (view.isEmpty()) {\n      if (currentMetadataLocation() != null) {\n        throw new NoSuchViewException(\"View does not exist: %s\", viewIdentifier);\n      } else {\n        this.disableRefresh();\n        return;\n      }\n    }\n\n    String newMetadataLocation = view.get(JdbcTableOperations.METADATA_LOCATION_PROP);\n    Preconditions.checkState(\n        newMetadataLocation != null, \"Invalid view %s: metadata location is null\", viewIdentifier);","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/jdbc/JdbcViewOperations.java#L56-L92","documentation":"Thrown by JdbcViewOperations.doRefresh when the thread is interrupted while loading the view record from the JDBC catalog via JdbcUtil.loadView. The interrupt flag is restored before throwing. It means the view refresh (which underpins every read of view metadata) was cancelled, not that the view is missing.","triggerScenarios":"Any view read/commit path that triggers doRefresh (e.g. catalog.loadView, view scans, commits) while the thread is interrupted during connection-pool acquisition or SQL execution.","commonSituations":"Spark/Flink task cancellation, application shutdown, or scheduled jobs cancelled while refreshing view metadata from a slow or overloaded database.","solutions":["Retry the loadView operation on a non-interrupted thread","Investigate why the thread was interrupted (job cancellation, timeout, shutdown hook)","Reduce query latency (indexes on the catalog tables, connection pool sizing) so refreshes complete before cancellation","Catch UncheckedInterruptedException in the caller and handle cancellation cleanly"],"exampleFix":"// before\nView view = catalog.loadView(ident);\n// after\ntry {\n  View view = catalog.loadView(ident);\n} catch (UncheckedInterruptedException e) {\n  Thread.currentThread().interrupt(); // already re-interrupted; handle cancellation\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":"if (Thread.currentThread().isInterrupted()) {\n  throw new IllegalStateException(\"Interrupted before view refresh\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  View view = catalog.loadView(ident);\n} catch (UncheckedInterruptedException e) {\n  Thread.currentThread().interrupt();\n  throw e; // propagate cancellation to the framework\n}","preventionTips":["Don't interrupt worker threads performing catalog reads","Re-acquire views after job restarts instead of reusing stale handles","Monitor for unexpected interrupts from framework cancellation"],"tags":["jdbc","interruption","view"],"backgroundTag":"thread-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"}