apache/hadoop · warning · InvalidRequestException
{this}: invalid negative slot index {slotIdx}
Error message
{this}: invalid negative slot index {slotIdx} What it means
registerSlot(slotIdx, blockId) runs on the datanode (ShortCircuitRegistry.registerSlot, called from DataXceiver) when a client that allocated a slot in the shared segment reports it while requesting short-circuit file descriptors. A negative index can never be valid - calculateSlotAddress would point before the mapping - so the datanode rejects it with InvalidRequestException. This is a protocol violation or corrupted request, not a tunable condition.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/shortcircuit/ShortCircuitShm.java:577
}
/**
* Register a slot.
*
* This function looks at a slot which has already been initialized (by
* another process), and registers it with us. Then, it returns the
* relevant Slot object.
*
* @return The slot.
*
* @throws InvalidRequestException
* If the slot index we're trying to allocate has not been
* 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()) {View on GitHub (pinned to 2add963021)
Solutions
- Verify client and datanode run the exact same Hadoop release
- Reproduce with trace logging on org.apache.hadoop.hdfs.shortcircuit to capture the offending slot index
- Restart the client to re-establish clean shm state
- If it persists on stock software, file a Hadoop JIRA with the trace logs
Defensive patterns
Strategy: try-catch
Validate before calling
// Client side: never hand-build SlotId values; only use indices returned by the shm layer Slot slot = shm.allocAndRegisterSlot(blockId); // idx >= 0 guaranteed here
Try / catch
try {
// datanode-side registration of client slots
} catch (InvalidRequestException e) {
// reject the client request; client re-establishes a fresh shm
} Prevention
- Version-match client and datanode; the slot-id encoding is protocol-coupled
- Never construct or mutate SlotId / slot indices outside the short-circuit API
When it happens
Trigger: DataXceiver opRequestShortCircuitFds receiving a SlotId whose slot index is negative: a client-side bug, a corrupted slot id, or version skew where the two sides disagree on the slot id encoding.
Common situations: Mixing Hadoop versions across the short-circuit protocol; patched or custom client builds; essentially never seen on unmodified releases.
Related errors
- {this}: slot {slotIdx} does not exist.
- {this}: invalid slot index {slotIdx}
- {this}: slot {slotIdx} is already in use.
- {this}: no more slots are available.
- {this}: slot {slotIdx} is not marked as valid.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/e59177999fbcca58.
Report an issue: GitHub.