Repository navigation
Fix dropped bytes in short range reads - #480
Merged
Merged
Conversation
When a range read returns fewer bytes than requested, getStorBytes pads the result to the requested length. The padding line was missing its assignment (`buffer[:(len(data))]` instead of `buffer[:len(data)] = data`), so it returned a zero buffer and discarded everything that was read, and returned success. A read now comes back short when it runs past the end of the object, as with an H5D_CONTIGUOUS_REF dataset whose last chunk extends past the end of its file. HSDS 1.0.x reads each contiguous reference as one chunk sized to its data, so it rarely hits this today, but it will once h5json splits those datasets into virtual chunks again (see HDFGroup/hdf5-json#380). This needs to ship before or with that h5json version bump on HSDS's side.
mattjala
force-pushed
the
fix/short-range-read-zero-fill
branch
from
October 2, 2026 17:27
89655e3 to
9cd3ecc
Compare
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.
When a range read returns fewer bytes than requested, getStorBytes pads the result to the requested length. The padding line was missing its assignment (
buffer[:(len(data))]instead ofbuffer[:len(data)] = data), so it returned a zero buffer and discarded everything that was read, and returned success.A read now comes back short when it runs past the end of the object, as with an H5D_CONTIGUOUS_REF dataset whose last chunk extends past the end of its file. HSDS 1.0.x reads each contiguous reference as one chunk sized to its data, so it rarely hits this today, but it will once h5json splits those datasets into virtual chunks again (see HDFGroup/hdf5-json#380).
This needs to ship before or with that h5json version bump on HSDS's side.