{"record":{"id":"d352f1e8a8522423","repo":"apache/iceberg","slug":"interrupted-while-waiting-for-idempotent-request-t","errorCode":null,"errorMessage":"Interrupted while waiting for idempotent request to complete","messagePattern":"Interrupted while waiting for idempotent request to complete","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"warning","filePath":"core/src/main/java/org/apache/iceberg/rest/CatalogHandlers.java","lineNumber":251,"sourceCode":"\n    void finalizeSuccess(Object body) {\n      this.responseBody = body;\n      this.status = Status.FINALIZED;\n      this.latch.countDown();\n    }\n\n    void finalizeError(RuntimeException cause) {\n      this.error = cause;\n      this.status = Status.FINALIZED;\n      this.latch.countDown();\n    }\n\n    void awaitFinalization() {\n      try {\n        this.latch.await();\n      } catch (InterruptedException ie) {\n        Thread.currentThread().interrupt();\n        throw new RuntimeException(\n            \"Interrupted while waiting for idempotent request to complete\", ie);\n      }\n    }\n\n    boolean isExpired() {\n      if (this.status != Status.FINALIZED) {\n        return false;\n      }\n\n      Instant expiry =\n          Instant.ofEpochMilli(this.firstSeenMillis).plusMillis(idempotencyLifetimeMillis);\n      return Instant.now().isAfter(expiry);\n    }\n  }\n\n  /**\n   * Exception used to avoid retrying commits when assertions fail.\n   *","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/rest/CatalogHandlers.java#L233-L269","documentation":"While a REST request waited for an idempotent (duplicate) request to finalize, the waiting thread was interrupted; the code restores the interrupt flag and wraps the InterruptedException in this RuntimeException. The server-side idempotency mechanism detected a repeated request and blocked awaiting the original's result, but the wait was cut short.","triggerScenarios":"Sending a request whose idempotency key matches an in-flight request, then having the waiting thread interrupted inside IdempotencyEntry.awaitFinalization (server shutdown, executor cancellation).","commonSituations":"REST server graceful shutdown while duplicate requests are pending; client timeouts cancelling handler threads; load-balancer retries hitting in-flight requests.","solutions":["Retry the request once the original completes","Avoid duplicate concurrent requests with the same idempotency key","Check server logs for the shutdown/interruption cause","Increase client timeouts so requests are not cancelled mid-wait"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Deduplicate client-side: track in-flight request keys before sending\nif (inFlightKeys.contains(idempotencyKey)) {\n  waitForKeyCompletion(idempotencyKey);\n}","typeGuard":null,"tryCatchPattern":"try {\n  send(request);\n} catch (RuntimeException e) {\n  if (e.getMessage().contains(\"Interrupted while waiting for idempotent request\")) {\n    retryWithBackoff(request);\n  }\n}","preventionTips":["Generate unique idempotency keys per logical request","Configure generous client timeouts","Drain in-flight requests before server shutdown"],"tags":["rest-catalog","idempotency","interrupt","concurrency"],"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"}