apache/hadoop · warning · InvalidRequestException

{this}: slot {slotIdx} is not marked as valid.

Error message

{this}: slot {slotIdx} is not marked as valid.

What it means

Datanode-side registerSlot's final check reads the slot's valid flag in the shared memory itself. The client is expected to mark its allocated slot valid (Slot.makeValid writes a nonzero word into the segment) before the datanode registers it; reading zero means the write was not performed or not yet visible, so registration aborts with InvalidRequestException 'not marked as valid'.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/shortcircuit/ShortCircuitShm.java:590

   *            initialized, or is already in use.
   */
  synchronized public final Slot registerSlot(int slotIdx,
      ExtendedBlockId blockId) throws InvalidRequestException {
    if (slotIdx < 0) {
      throw new InvalidRequestException(this + ": invalid negative slot " +
          "index " + slotIdx);
    }
    if (slotIdx >= slots.length) {
      throw new InvalidRequestException(this + ": invalid slot " +
          "index " + slotIdx);
    }
    if (allocatedSlots.get(slotIdx)) {
      throw new InvalidRequestException(this + ": slot " + slotIdx +
          " is already in use.");
    }
    Slot slot = new Slot(calculateSlotAddress(slotIdx), blockId);
    if (!slot.isValid()) {
      throw new InvalidRequestException(this + ": slot " + slotIdx +
          " is not marked as valid.");
    }
    slots[slotIdx] = slot;
    allocatedSlots.set(slotIdx, true);
    if (LOG.isTraceEnabled()) {
      LOG.trace(this + ": registerSlot " + slotIdx + ": allocatedSlots=" + allocatedSlots +
                  StringUtils.getStackTrace(Thread.currentThread()));
    }
    return slot;
  }

  /**
   * Unregisters a slot.
   *
   * This doesn't alter the contents of the slot.  It just means
   *
   * @param slotIdx  Index of the slot to unregister.
   */

View on GitHub (pinned to 2add963021)

Solutions

  1. Treat as transient: retry the open - the slot is normally valid moments later
  2. Restart the client if the error floods the datanode log
  3. Ensure unmodified Hadoop client builds are in use on the short-circuit path
  4. If persistent, capture trace logs on org.apache.hadoop.hdfs.shortcircuit and file a JIRA
Defensive patterns

Strategy: retry

Try / catch

try {
  // open with short-circuit reads
} catch (InvalidRequestException e) {
  // slot valid-flag not visible yet (race): brief backoff and retry once
}

Prevention

When it happens

Trigger: DataXceiver handling a short-circuit fds request whose SlotId points at a slot whose word still reads 0: a client/datanode race (registration arriving before the client's makeValid write lands), a memory-visibility problem across the mmap, or a nonstandard client that skips the step.

Common situations: Tight request races on loaded machines; custom clients built against Hadoop internals; unusual JVMs with weak cross-process visibility behavior on mmapped memory.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/57054c05af75d885. Report an issue: GitHub.