apache/iceberg · error · RuntimeException
Interrupted during refresh
Error message
Interrupted during refresh
What it means
HiveViewOperations.doRefresh catches InterruptedException from the metastore RPC, restores the thread's interrupt flag, and throws a RuntimeException. This means the thread waiting on the HMS view fetch was interrupted (e.g., task cancellation or shutdown), and the refresh did not complete.
Solutions
- Inspect why the thread was interrupted (job cancellation, shutdown hook) and re-run the operation in a live thread if the work should continue.
- If intentional shutdown, treat this as expected cleanup; do not suppress the interrupt flag (the code already re-sets it).
- Add retry logic around refresh only when the interruption was spurious and cancellation is not in progress.
- Increase cancellation grace periods in your engine so refreshes finish or are cancelled cleanly.
Example fix
// before
view.refresh(); // RuntimeException("Interrupted during refresh") on cancel
// after
try {
view.refresh();
} catch (RuntimeException e) {
if (Thread.currentThread().isInterrupted()) { /* honoring cancel; abort */ return; }
throw e;
} Defensive patterns
Strategy: try-catch
Validate before calling
if (Thread.currentThread().isInterrupted()) {
throw new IllegalStateException("Thread already interrupted; skipping view refresh");
} Try / catch
try {
view.refresh();
} catch (RuntimeException e) {
if (e.getMessage() != null && e.getMessage().contains("Interrupted during refresh")) {
// cancellation in progress: abort cleanly; interrupt flag is already restored
return;
}
throw e;
} Prevention
- Avoid interrupting worker threads during metastore calls unless cancelling intentionally.
- Configure adequate cancellation grace periods in Spark/Flink.
- Check Thread.interrupted() before long-running metastore operations.
- Treat this exception as cancellation, not a data error.
When it happens
Trigger: Refreshing a Hive view while the executing thread is interrupted — e.g., Spark task cancellation, executor shutdown, query kill, or application stop during the HMS getView call.
Common situations: Cancelling a long-running Spark/Flink job; cluster node decommissioning; timeout-based cancellation frameworks interrupting blocked thrift calls.
Understand the failure class
Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.
Related errors
- Cannot commit: Base metadata location
- Failed to get view info from metastore
- Failed to unlock even on 2nd attempt
- Interrupted during commit
- Interrupted in call to createDatabase(name)
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/8612e7b5da6191e3.
Report an issue: GitHub.
Appendix: source
Thrown at hive-metastore/src/main/java/org/apache/iceberg/hive/HiveViewOperations.java:112
// Check if we are trying to load an Iceberg Table as a View
HiveOperationsBase.validateIcebergTableNotLoadedAsIcebergView(table, fullName);
// Check if it is a valid Iceberg View
HiveOperationsBase.validateTableIsIcebergView(table, fullName);
metadataLocation =
table.getParameters().get(BaseMetastoreTableOperations.METADATA_LOCATION_PROP);
} catch (NoSuchObjectException e) {
if (currentMetadataLocation() != null) {
throw new NoSuchViewException("View does not exist: %s.%s", database, viewName);
}
} catch (TException e) {
String errMsg =
String.format("Failed to get view info from metastore %s.%s", database, viewName);
throw new RuntimeException(errMsg, e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException("Interrupted during refresh", e);
}
refreshFromMetadataLocation(metadataLocation);
}
@SuppressWarnings("checkstyle:CyclomaticComplexity")
@Override
public void doCommit(ViewMetadata base, ViewMetadata metadata) {
boolean newView = base == null;
String newMetadataLocation = writeNewMetadataIfRequired(metadata);
boolean hiveEngineEnabled = false;
CommitStatus commitStatus = CommitStatus.FAILURE;
boolean updateHiveView = false;
HiveLock lock = lockObject();
try {
lock.lock();View on GitHub (pinned to 86d9c8fc54)