Repository navigation
fix(rados): list objects a page at a time - #6
Merged
AlexanderSlaa merged 2 commits intoNov 21, 2026
Merged
Conversation
This was referenced Nov 21, 2026
AlexanderSlaa
left a comment
Contributor
There was a problem hiding this comment.
Thanks for your contribution!
Verified:
- 2500 objects are each listed exactly once with the default page size and with page sizes 1, 7, 2500 and 10000;
- an empty namespace lists nothing;
pageSize: 0rejects withRangeError, and the listing is still closed;- two listings of one io context run side by side;
- an open listing makes
io.close()fail with EBUSY, and leaving the loop releases it; - an abandoned listing is closed when it is garbage collected.
Two notes:
- With #2: the listing is opened lazily in the first
next()on the thread pool, so it uses the namespace at that moment, not atobjects(). Once #2 is in, an open listing should count as in flight, the same as a watch, orsetNamespacebetweenobjects()and the first page changes what gets listed. This also conflicts with #2 inio_context.cpp. - Minor: if the wrapper is garbage collected while a page is being read,
~ObjectListWrapcallsclose()on the main thread and waits ondata->mutexuntil that page finishes. That's rare and short, but it does block the event loop.
IoContext.objects() is an async generator, but it got its entries from one native call that read the whole listing into a vector on the thread pool and converted all of it to JavaScript at once. For a pool with millions of objects that holds every name in memory twice and keeps a thread busy for the whole listing before the first entry is yielded. The listing is now a native handle that reads a page of entries per call (pageSize, 1024 by default). objects() yields each page as it arrives and closes the listing when the loop ends, also when the caller leaves it early. An open listing keeps its io context from being destroyed, like a watch.
A listing reads the io context's namespace when its first page is read, so setNamespace() between objects() and that page changed what was listed. An open listing now blocks the setters with EBUSY, the same as a registered watch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AlexanderSlaa
force-pushed
the
fix/stream-object-listing
branch
from
November 21, 2026 21:38
71499e7 to
d28ce0d
Compare
github-actions Bot
pushed a commit
that referenced
this pull request
Nov 21, 2026
## [1.1.1](v1.1.0...v1.1.1) (2026-11-21) ### Bug Fixes * **rados:** list objects a page at a time ([#6](#6)) ([61d68c9](61d68c9))
|
🎉 This PR is included in version 1.1.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Contributor
|
Thanks for your contribution! Merged. #2 landed first, so I rebased this onto
Your commit is unchanged apart from the conflict resolution: |
This was referenced Nov 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.
IoContext.objects()is an async generator, but it got its entries from one native call. That call read the whole listing into memory on the thread pool and converted all of it to JavaScript at once. For a pool with millions of objects, every name is in memory twice, and the first entry only arrives after the whole pool has been listed.The listing is now a native handle that reads one page per call.
objects()yields each page as it arrives. The page size is set with{pageSize}and defaults to 1024. The listing is closed when the loop ends, also when the caller leaves it early. While a listing is open, its io context can't be destroyed, the same as with a watch.The integration test lists 25 objects in pages of 4. It also leaves a listing early, which would make the io context's close fail with EBUSY if the listing weren't closed.