Repository navigation
hashtable iterator safety: invalidate on exhaustion - #3551
Merged
Merged
Conversation
JimB123
approved these changes
Apr 23, 2026
|
|
||
| /* Cleanup is a no-op but must not crash. */ | ||
| hashtableCleanupIterator(&iter); | ||
| hashtableRelease(ht); |
Member
There was a problem hiding this comment.
If we don't have this covered somewhere else, it might be interesting for one of these tests to call hashtableRelease before calling hashtableCleanupIterator
Contributor
Author
There was a problem hiding this comment.
We do have one like this that tests safe iterator tracking, and I added one that specifically exhausts the iterator first.
Signed-off-by: Rain Valentine <rsg000@gmail.com>
rainsupreme
force-pushed
the
hashtable-iter-safety
branch
from
April 23, 2026 21:37
8be8843 to
f9df959
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## unstable #3551 +/- ##
============================================
- Coverage 76.34% 76.22% -0.12%
============================================
Files 159 159
Lines 80045 80091 +46
============================================
- Hits 61107 61052 -55
- Misses 18938 19039 +101
🚀 New features to boost your workflow:
|
Member
|
@JimB123 we normally use squash merge |
sarthakaggarwal97
added a commit
that referenced
this pull request
Sep 16, 2026
Remove three entries whose changes shipped before 9.2.0, so 9.1 users don't see them advertised as new: - #3533 (dismissHashtable madvise size) was backported to 9.1 and is in the 9.1.0, 9.1.1 and 9.1.2 tags. It was added here by mistake. - #3551 (hashtable iterator invalidate on exhaustion) is likewise in 9.1.0; it just never made the 9.1 notes. - #3586 (valkey-cli --cluster fix slot spreading) is already documented in both the 9.0 and 9.1 release notes and shipped in 9.0.6 and 9.1.0. Fix the #4076 config name: the registered config is priority-preemptive-poll-interval-us, not preemptive-poll-interval-us, so the name as written would be rejected by CONFIG SET. Rewrite the #4005 entry, which described only the internal tagging. The user-facing surface is two new configs, priority-subnets and maxclients-reserved, which together cap normal clients at maxclients minus the reserved count so administrative clients keep guaranteed slots, plus a connected_priority_clients field in INFO clients. Move the sorted set B+ tree note (#4359) back to Performance. Listing it as a behavior change for its OBJECT ENCODING output while #3212 changes hash encoding output from hashtable to listpack in the Performance section was inconsistent; both now sit together. Drop the Redis comparison from the #4629 entry, which no other entry in the 9.0, 9.1 or 9.2 notes makes. Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
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.
PR #2611 is abandoned, so I'm raising this PR to guard against the same potential issue.
If anyone called hashtableNext after it has returned false, it may re-enter the loop with stale table/index values. If the hashtable has been resized/rehashed since the first exhaustion so this may result in out of bounds access.
It also somewhat guards against the caller forgetting to clean up the iterator and leaving rehash disabled indefinitely resulting in accumulating performance degradation, but of course relying on this to automatically clean up should be avoided.