[fs] Fail fast on zero-byte skip in HadoopCompliantFileIO wrappers - #9779
Draft
LuciferYang wants to merge 1 commit into
Draft
[fs] Fail fast on zero-byte skip in HadoopCompliantFileIO wrappers#9779LuciferYang wants to merge 1 commit into
LuciferYang wants to merge 1 commit into
Conversation
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
marked this pull request as draft
September 13, 2026 03:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
close #9778
skipFullyloopedwhile (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
EOFExceptionwhen a skip call makes no progress. The same loop was replicated inHadoopFileIOand in everyHadoopCompliantFileIOwrapper (azure, cosn, gs, jindo, obs, oss, s3); all copies are updated.Tests
HadoopFileIOSkipFullyTest: reflection into the private stream class with a mockedFSDataInputStreamwhose skip returns 0 — asserts theEOFExceptionand message. RED verified on master: the unfixed loop surfaces the stub'sIOExceptioninstead ofEOFException(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.