{"record":{"id":"632ea52b17d57843","repo":"apache/hadoop","slug":"this-slot-slotidx-does-not-exist","errorCode":null,"errorMessage":"{this}: slot {slotIdx} does not exist.","messagePattern":"(.+?): slot (.+?) does not exist\\.","errorType":"exception","errorClass":"InvalidRequestException","httpStatus":null,"severity":"warning","filePath":"hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/shortcircuit/ShortCircuitShm.java","lineNumber":555,"sourceCode":"    if (idx >= slots.length) {\n      throw new RuntimeException(this + \": no more slots are available.\");\n    }\n    allocatedSlots.set(idx, true);\n    Slot slot = new Slot(calculateSlotAddress(idx), blockId);\n    slot.clear();\n    slot.makeValid();\n    slots[idx] = slot;\n    if (LOG.isTraceEnabled()) {\n      LOG.trace(this + \": allocAndRegisterSlot \" + idx + \": allocatedSlots=\" + allocatedSlots +\n                  StringUtils.getStackTrace(Thread.currentThread()));\n    }\n    return slot;\n  }\n\n  synchronized public final Slot getSlot(int slotIdx)\n      throws InvalidRequestException {\n    if (!allocatedSlots.get(slotIdx)) {\n      throw new InvalidRequestException(this + \": slot \" + slotIdx +\n          \" does not exist.\");\n    }\n    return slots[slotIdx];\n  }\n\n  /**\n   * Register a slot.\n   *\n   * This function looks at a slot which has already been initialized (by\n   * another process), and registers it with us.  Then, it returns the\n   * relevant Slot object.\n   *\n   * @return    The slot.\n   *\n   * @throws InvalidRequestException\n   *            If the slot index we're trying to allocate has not been\n   *            initialized, or is already in use.\n   */","sourceCodeStart":537,"sourceCodeEnd":573,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/shortcircuit/ShortCircuitShm.java#L537-L573","documentation":"ShortCircuitShm.getSlot(slotIdx) returns a previously registered slot; on the datanode it is reached through ShortCircuitRegistry.unregisterSlot when a client releases a short-circuit slot. If the index's bit is not set in the segment's allocatedSlots BitSet, the slot was never registered (or was already unregistered) on this side, and InvalidRequestException '<shm>: slot <idx> does not exist.' is thrown - a client/datanode bookkeeping mismatch on the shared-memory registry.","triggerScenarios":"A datanode processing a client's slot release / short-circuit cleanup that references a slot index it never registered in that shm: stale SlotId after the datanode restarted and recreated its registry, or a client referencing a slot it already released.","commonSituations":"Datanode restarts while long-lived clients kept their shm segments; rolling upgrades; client and datanode Hadoop version skew in the shm-slot protocol; duplicated release requests.","solutions":["Restart long-lived client applications after a datanode restart so they re-establish shm segments","Check for version skew between client and datanode; the shm slot protocol must match","Treat as transient - clients re-request a new shm after InvalidRequestException and recover; confirm the flood stops in datanode logs","If persistent, gather datanode log context around opRequestShortCircuitFds / opReleaseShortCircuitFds and file a JIRA"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  // short-circuit operations carrying a SlotId\n} catch (InvalidRequestException e) {\n  // slot bookkeeping is stale: drop the cached shm/slot and re-establish the short-circuit session\n}","preventionTips":["Recreate long-lived client DFSClient instances after datanode restarts","Keep client and datanode on matched Hadoop versions when using short-circuit reads"],"tags":["hdfs","short-circuit-read","shared-memory","slots","datanode","stale-state"],"backgroundTag":"shared-memory-slot-registration","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}