{"record":{"id":"7a13dbe0abc45220","repo":"apache/hadoop","slug":"interrupted-waiting-for-dofinalize-response","errorCode":null,"errorMessage":"Interrupted waiting for doFinalize() response","messagePattern":"Interrupted waiting for doFinalize\\(\\) response","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java","lineNumber":713,"sourceCode":"    } catch (InterruptedException e) {\n      throw new IOException(\"Interrupted waiting for doUpgrade() response\");\n    } catch (TimeoutException e) {\n      throw new IOException(\"Timed out waiting for doUpgrade() response\");\n    }\n  }\n  \n  @Override\n  public void doFinalize() throws IOException {\n    QuorumCall<AsyncLogger, Void> call = loggers.doFinalize();\n    try {\n      call.waitFor(loggers.size(), loggers.size(), 0, timeoutMs,\n          \"doFinalize\");\n      \n      if (call.countExceptions() > 0) {\n        call.rethrowException(\"Could not finalize one or more JournalNodes\");\n      }\n    } catch (InterruptedException e) {\n      throw new IOException(\"Interrupted waiting for doFinalize() response\");\n    } catch (TimeoutException e) {\n      throw new IOException(\"Timed out waiting for doFinalize() response\");\n    }\n  }\n  \n  @Override\n  public boolean canRollBack(StorageInfo storage, StorageInfo prevStorage,\n      int targetLayoutVersion) throws IOException {\n    QuorumCall<AsyncLogger, Boolean> call = loggers.canRollBack(storage,\n        prevStorage, targetLayoutVersion);\n    try {\n      call.waitFor(loggers.size(), loggers.size(), 0, timeoutMs,\n          \"lockSharedStorage\");\n      \n      if (call.countExceptions() > 0) {\n        call.rethrowException(\"Could not check if roll back possible for\"\n            + \" one or more JournalNodes\");\n      }","sourceCodeStart":695,"sourceCodeEnd":731,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java#L695-L731","documentation":"QuorumJournalManager.doFinalize() finalizes the upgrade on every JournalNode and waits for ALL of them within dfs.qjm.operations.timeout. InterruptedException means the finalization-driving thread was cancelled, and it is converted to IOException.","triggerScenarios":"The upgrade finalization command is interrupted while JournalNodes are still finalizing — operator cancels 'hdfs dfsadmin -finalizeUpgrade'-driven flow, automation kills the step, or the JVM shuts down.","commonSituations":"Cancelled or timed-out upgrade finalization scripts; interrupted maintenance windows.","solutions":["Stop the interrupting source and rerun finalization to completion.","Inspect JournalNode directory state afterwards (previous/ removal) to confirm whether finalize partially applied.","Ensure all JournalNodes are reachable so the rerun finishes within dfs.qjm.operations.timeout."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  qjm.doFinalize();\n} catch (IOException e) {\n  if (Thread.currentThread().isInterrupted()\n      || (e.getMessage() != null && e.getMessage().contains(\"Interrupted waiting for doFinalize\"))) {\n    Thread.currentThread().interrupt();\n    // finalization cancelled: check previous/ dirs on JNs, then rerun\n    throw new IllegalStateException(\"finalize cancelled; rerun to completion\", e);\n  }\n  throw e;\n}","preventionTips":["Let finalize-upgrade run to completion; do not script-kill it on a clock timeout.","After an interrupted finalize, inspect each JournalNode's previous/ directory before rerunning."],"tags":["hdfs","qjm","journal-node","upgrade","finalize","interrupted","ha"],"backgroundTag":"operation-interrupted","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}