{"record":{"id":"42a6eefa2e31ebe3","repo":"apache/hadoop","slug":"interrupted-waiting-for-locksharedstorage-respon","errorCode":null,"errorMessage":"Interrupted waiting for lockSharedStorage() response","messagePattern":"Interrupted waiting for lockSharedStorage\\(\\) 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":744,"sourceCode":"          \"lockSharedStorage\");\n      \n      if (call.countExceptions() > 0) {\n        call.rethrowException(\"Could not check if roll back possible for\"\n            + \" one or more JournalNodes\");\n      }\n      \n      // Either they all return the same thing or this call fails, so we can\n      // just return the first result.\n      try {\n        DFSUtil.assertAllResultsEqual(call.getResults().values());\n      } catch (AssertionError ae) {\n        throw new IOException(\"Results differed for canRollBack\", ae);\n      }\n      for (Boolean result : call.getResults().values()) {\n        return result;\n      }\n    } catch (InterruptedException e) {\n      throw new IOException(\"Interrupted waiting for lockSharedStorage() \" +\n          \"response\");\n    } catch (TimeoutException e) {\n      throw new IOException(\"Timed out waiting for lockSharedStorage() \" +\n          \"response\");\n    }\n    \n    throw new AssertionError(\"Unreachable code.\");\n  }\n\n  @Override\n  public void doRollback() throws IOException {\n    QuorumCall<AsyncLogger, Void> call = loggers.doRollback();\n    try {\n      call.waitFor(loggers.size(), loggers.size(), 0, timeoutMs,\n          \"doRollback\");\n      \n      if (call.countExceptions() > 0) {\n        call.rethrowException(\"Could not perform rollback of one or more JournalNodes\");","sourceCodeStart":726,"sourceCodeEnd":762,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java#L726-L762","documentation":"Thrown while canRollBack() was blocked in waitFor() and the waiting thread was interrupted. Note the message text says 'lockSharedStorage()' — a copy-paste quirk in the source; the operation actually in flight is the canRollBack quorum call. InterruptedException is converted to an IOException without restoring the interrupt flag.","triggerScenarios":"Thread interrupt arrives during canRollBack(): the NameNode is shutting down mid-rollback-check, an HA failover transitions the NN out of the executing state, or caller code cancels the operation by interrupting it.","commonSituations":"'hdfs namenode -rollback' interrupted by operator Ctrl-C or a shutdown hook; automated upgrade tooling that times out the overall procedure and interrupts the worker thread; JVM shutdown during HA state transitions.","solutions":["Check what interrupted the thread: look for a preceding NN shutdown/failover or operator cancellation in the logs — the interrupt is the symptom, not the fault.","If the interruption was accidental (tooling timeout on the outer step), widen that outer limit or remove the interrupt and re-run the rollback check.","Re-run the canRollBack/rollback sequence once the cluster is in a stable, single-writer state.","If you are calling this API directly in your own tooling, never interrupt the thread performing quorum waits; cancel at a checkpoint between calls instead."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"static boolean wasInterruptedWait(IOException ioe) {\n  return ioe.getCause() instanceof InterruptedException\n      || ioe.getMessage().startsWith(\"Interrupted waiting\");\n}","tryCatchPattern":"try {\n  qjm.canRollBack(storage, prevStorage, targetLayoutVersion);\n} catch (IOException ioe) {\n  if (wasInterruptedWait(ioe)) {\n    Thread.currentThread().interrupt(); // restore the flag, then unwind cleanly\n    return OperationStatus.CANCELLED;\n  }\n  throw ioe;\n}","preventionTips":["Never interrupt a thread in a QJM quorum wait — cancel between operations instead.","In automation, set outer timeouts larger than the worst-case dfs.qjm.operations.timeout so tooling does not interrupt the NN mid-check.","Note the message quirk: 'lockSharedStorage()' here actually means the canRollBack wait."],"tags":["qjm","rollback","interrupt","shutdown","misleading-message"],"backgroundTag":"thread-interrupted","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}