Skip to content

[fs] Fail fast on zero-byte skip in HadoopCompliantFileIO wrappers - #9779

Draft
LuciferYang wants to merge 1 commit into
apache:masterfrom
LuciferYang:fix/skipfully-zero-skip-hang
Draft

[fs] Fail fast on zero-byte skip in HadoopCompliantFileIO wrappers#9779
LuciferYang wants to merge 1 commit into
apache:masterfrom
LuciferYang:fix/skipfully-zero-skip-hang

Conversation

@LuciferYang

Copy link
Copy Markdown
Contributor

Purpose

close #9778

skipFully looped while (bytes > 0) { bytes -= in.skip(bytes); }. A blocking stream at end of file returns 0 from skip, so a small forward seek (up to 1 MiB, used by the vectored-read seek helper) past a truncated or shorter-than-expected file spun forever instead of failing the read with an end-of-file error.

Throw EOFException when a skip call makes no progress. The same loop was replicated in HadoopFileIO and in every HadoopCompliantFileIO wrapper (azure, cosn, gs, jindo, obs, oss, s3); all copies are updated.

Tests

HadoopFileIOSkipFullyTest: reflection into the private stream class with a mocked FSDataInputStream whose skip returns 0 — asserts the EOFException and message. RED verified on master: the unfixed loop surfaces the stub's IOException instead of EOFException (a pure always-0 stub spins forever on master, which is the bug).

API and Format

No format change. For every stream that makes progress, behavior is unchanged; only the previously-hanging case now fails loudly.

Documentation

None.

skipFully looped while (bytes > 0) subtracting whatever in.skip
returned. A blocking stream at end of file returns 0 from skip, so
a small forward seek (up to 1 MiB, used by the vectored-read
helpers) past a truncated or shorter-than-expected file spun the
loop forever instead of failing the read with an end-of-file error.

Throw EOFException when a skip call makes no progress. The same
loop was replicated in HadoopFileIO and in every
HadoopCompliantFileIO wrapper (azure, cosn, gs, jindo, obs, oss,
s3); all copies are updated.

Assisted-by: GLM-5.3
@LuciferYang
LuciferYang marked this pull request as draft September 13, 2026 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] skipFully spins forever on a zero-byte skip at end of stream

1 participant