Repository navigation
Object store get: no wait for an empty object, no NPE on a single chunk with no data - #1644
Merged
Merged
Conversation
…nk with no data - An object with 0 chunks no longer subscribes and waits the JetStream timeout for chunks that do not exist. - A single chunk read without direct get can have null data; it is no longer passed to the digester, so the size check reports the mismatch instead of a NullPointerException. - New ObjectStoreTests.testEmptyObject and testSingleChunkWithNoData.
|
Claude finished @scottf's task in 58s —— View job Review complete
Summary: Both fixes in
No security, thread-safety, or API-compatibility concerns. Tests look solid and exercise both fixed paths directly. |
aricart
self-requested a review
October 21, 2026 12:24
aricart
approved these changes
Oct 21, 2026
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.
Two read-side fixes in
NatsObjectStore.get.Empty object.
putof an empty stream stores an object with 0 chunks.getonly special-cased 1 chunk, so for 0 chunks it subscribed and waited innextMessage(jsm.getTimeout())for chunks that do not exist, then passed the size and digest checks. Everygetof an empty object took the full JetStream timeout (2 s by default). The chunk read is now skipped when the object has no chunks.Single chunk with no data. Without direct get, the message get API returns no
datafor an empty payload, soMessageInfo.getData()is null. The single-chunk branch passed it todigester.update(...), which threw aNullPointerException. The data is now digested and written only when present, so the existing size check reports the mismatch.Tests, in
ObjectStoreTests:testEmptyObject: puts an empty object, assertsgetreturns before the JetStream timeout with size 0 and 0 chunks. Without the fix it fails, eachgettaking 2.1 to 2.3 s.testSingleChunkWithNoData: puts a one-chunk object, turns offallowDirecton the stream, publishes an empty payload as the chunk, and assertsgetthrows theOsGetSizeMismatcherror. Without the fix it fails withNullPointerException.ObjectStoreTests: 13 tests, 0 failures.🤖 Generated with Claude Code