{"record":{"id":"b57754fad1f56a2d","repo":"apache/hadoop","slug":"interrupted-while-determining-if-jns-have-data","errorCode":null,"errorMessage":"Interrupted while determining if JNs have data","messagePattern":"Interrupted while determining if JNs have data","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":276,"sourceCode":"      throw new IOException(\"Interrupted waiting for format() response\");\n    } catch (TimeoutException e) {\n      throw new IOException(\"Timed out waiting for format() response\");\n    }\n    \n    if (call.countExceptions() > 0) {\n      call.rethrowException(\"Could not format one or more JournalNodes\");\n    }\n  }\n\n  @Override\n  public boolean hasSomeData() throws IOException {\n    QuorumCall<AsyncLogger, Boolean> call =\n        loggers.isFormatted();\n\n    try {\n      call.waitFor(loggers.size(), 0, 0, timeoutMs, \"hasSomeData\");\n    } catch (InterruptedException e) {\n      throw new IOException(\"Interrupted while determining if JNs have data\");\n    } catch (TimeoutException e) {\n      throw new IOException(\"Timed out waiting for response from loggers\");\n    }\n    \n    if (call.countExceptions() > 0) {\n      call.rethrowException(\n          \"Unable to check if JNs are ready for formatting\");\n    }\n    \n    // If any of the loggers returned with a non-empty manifest, then\n    // we should prompt for format.\n    for (Boolean hasData : call.getResults().values()) {\n      if (hasData) {\n        return true;\n      }\n    }\n\n    // Otherwise, none were formatted, we can safely format.","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java#L258-L294","documentation":"QJM.hasSomeData() asks each JournalNode whether it already holds data (this drives the 'Re-format filesystem?' prompt before formatting). The wait was interrupted: the querying thread was cancelled, typically aborting the format/bootstrap step, and the InterruptedException is converted to IOException.","triggerScenarios":"The NameNode bootstrap/format thread is interrupted while checking JournalNodes for existing data — the user aborts namenode -format, automation kills the step, or a test harness times out.","commonSituations":"Cancelled cluster bootstrap scripts; interrupted HA re-format workflows; CI harnesses interrupting format commands.","solutions":["Rerun the format/bootstrap command to completion with nothing interrupting it.","If the interrupt was unexpected, find the source (shutdown hook, orchestration kill) in the NN logs.","Verify all JournalNodes are reachable so the rerun finishes within dfs.qjm.operations.timeout."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  boolean hasData = qjm.hasSomeData();\n} catch (IOException e) {\n  if (Thread.currentThread().isInterrupted()\n      || (e.getMessage() != null && e.getMessage().contains(\"Interrupted while determining\"))) {\n    Thread.currentThread().interrupt();\n    // bootstrap step cancelled: rerun the format flow when not interrupted\n    throw new IllegalStateException(\"hasSomeData check cancelled; rerun bootstrap\", e);\n  }\n  throw e;\n}","preventionTips":["Give bootstrap/format scripts run-to-completion timeouts; avoid Ctrl-C mid-check.","Rerun the interrupted format command rather than assuming namespace state from a half-run."],"tags":["hdfs","qjm","journal-node","format","interrupted"],"backgroundTag":"operation-interrupted","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}