{"record":{"id":"d505bbce22d36138","repo":"apache/iceberg","slug":"interrupted-while-listing-tables-for-scope-s","errorCode":null,"errorMessage":"Interrupted while listing tables for scope '%s'","messagePattern":"Interrupted while listing tables for scope '(.+?)'","errorType":"exception","errorClass":"UncheckedInterruptedException","httpStatus":null,"severity":"warning","filePath":"snowflake/src/main/java/org/apache/iceberg/snowflake/JdbcSnowflakeClient.java","lineNumber":317,"sourceCode":"        break;\n      default:\n        throw new IllegalArgumentException(\n            String.format(\"Unsupported scope type for listIcebergTables: %s\", scope));\n    }\n\n    final String finalQuery = baseQuery.toString();\n    final String[] finalQueryParams = queryParams;\n    List<SnowflakeIdentifier> tables;\n    try {\n      tables =\n          connectionPool.run(\n              conn ->\n                  queryHarness.query(conn, finalQuery, TABLE_RESULT_SET_HANDLER, finalQueryParams));\n    } catch (SQLException e) {\n      throw snowflakeExceptionToIcebergException(\n          scope, e, String.format(\"Failed to list tables for scope '%s'\", scope));\n    } catch (InterruptedException e) {\n      throw new UncheckedInterruptedException(\n          e, \"Interrupted while listing tables for scope '%s'\", scope);\n    }\n    tables.forEach(\n        table ->\n            Preconditions.checkState(\n                table.type() == SnowflakeIdentifier.Type.TABLE,\n                \"Expected TABLE, got identifier '%s' for scope '%s'\",\n                table,\n                scope));\n    return tables;\n  }\n\n  @Override\n  public SnowflakeTableMetadata loadTableMetadata(SnowflakeIdentifier tableIdentifier) {\n    Preconditions.checkArgument(\n        tableIdentifier.type() == SnowflakeIdentifier.Type.TABLE,\n        \"loadTableMetadata requires a TABLE identifier, got '%s'\",\n        tableIdentifier);","sourceCodeStart":299,"sourceCodeEnd":335,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/snowflake/src/main/java/org/apache/iceberg/snowflake/JdbcSnowflakeClient.java#L299-L335","documentation":"JdbcSnowflakeClient.listIcebergTables wraps InterruptedException raised during the Iceberg-tables listing JDBC query into UncheckedInterruptedException, including the scope in the message. The listing was cancelled by thread interruption; SQLExceptions are converted separately via snowflakeExceptionToIcebergException.","triggerScenarios":"Thread interrupted while the SHOW TABLES/ICEBERG TABLES query for the given scope runs — due to task cancellation, executor shutdownNow, or timeout-driven interrupts in the query harness.","commonSituations":"Spark/Flink job cancellation during table listing, service shutdown with catalog calls in flight, or long-running account-wide listings getting interrupted by timeout policies.","solutions":["Handle UncheckedInterruptedException by restoring the interrupt flag and aborting cleanly","Tune the cancellation source (increase timeouts, disable speculative execution, orderly shutdown)","Retry the listing after confirming cancellation was not intentional","Scope listings narrowly (schema-level) to minimize interruption exposure"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (Thread.currentThread().isInterrupted()) {\n  throw new InterruptedException(\"Interrupted before listIcebergTables call\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  client.listIcebergTables(scope);\n} catch (UncheckedInterruptedException e) {\n  Thread.currentThread().interrupt();\n  throw e;\n}","preventionTips":["Restore the interrupt flag when converting to unchecked interruption","Prefer narrower (schema-level) listings to reduce interruptible query time","Schedule listings outside shutdown/cancellation windows","Retry once after transient cancellation, then surface to the caller"],"tags":["snowflake","interruption","threading"],"backgroundTag":"request-timeout","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"}