apache/flink · error · EOFException

There is no enough data left in the DataInputView.

Error message

There is no enough data left in the DataInputView.

What it means

Thrown as an EOFException by AbstractPagedInputView.readFully(byte[],int,int) when the number of bytes actually read (via read()) is less than the requested length. AbstractPagedInputView reads across a chain of memory segments; if the segments are exhausted before fulfilling the request, the remaining bytes are unavailable and this exception signals truncation.

Source

Thrown at flink-core/src/main/java/org/apache/flink/core/memory/AbstractPagedInputView.java:265

                    this.positionInSegment += toRead;
                    break;
                }
            }
            return len;
        }
    }

    @Override
    public void readFully(byte[] b) throws IOException {
        readFully(b, 0, b.length);
    }

    @Override
    public void readFully(byte[] b, int off, int len) throws IOException {
        int bytesRead = read(b, off, len);

        if (bytesRead < len) {
            throw new EOFException("There is no enough data left in the DataInputView.");
        }
    }

    @Override
    public boolean readBoolean() throws IOException {
        return readByte() == 1;
    }

    @Override
    public byte readByte() throws IOException {
        if (this.positionInSegment < this.limitInSegment) {
            return this.currentSegment.get(this.positionInSegment++);
        } else {
            advance();
            return readByte();
        }
    }

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Verify the serialized data was written by the matching serializer and is not truncated.
  2. Check that the segment chain length matches the expected record size.
  3. Inspect for field-order or type mismatches between writer and reader that cause over-reading.
  4. If reading from a stream, ensure the stream was fully written and not cut off.

Example fix

// before
inputView.readFully(buffer); // throws if data is short

// after — defensive length check before bulk read
int available = inputView.available();
if (available < buffer.length) {
    throw new IOException("Expected " + buffer.length
        + " bytes but only " + available + " available");
}
inputView.readFully(buffer);
Defensive patterns

Strategy: try-catch

Try / catch

try {
    inputView.readFully(buffer);
} catch (EOFException e) {
    // data is shorter than expected; verify record integrity or regenerate state
}

Prevention

When it happens

Trigger: Reading more bytes than remain in the paged segment stream; deserializing a record whose declared length exceeds the available data; a segment chain that was truncated or under-allocated; reading past the end of a serialized record boundary.

Common situations: Corrupted or truncated serialized data in checkpoints; mismatched serialize/deserialize field orders causing over-read; network or storage truncation of paged state data.

Related errors


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/5d5e9b00286044c9. Report an issue: GitHub.