You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit df12d45
Browse filesBrowse the repository at this point in the historyBrowse files
fix: hasNext() on a RocksDB iterator crashed the JVM after exhaustion
EntrySet, KeySet and ValueSet close the native RocksIterator the first time
hasNext() answers false. hasNext() is idempotent by contract, so a second call
reached isValid() on the freed handle. BoundedStream's skip loop exhausts the
iterator and then the caller asks once more, so any find(..., skipBy(n)) whose
skip exceeds the remaining records hit it — ordinary paging, not an edge case.
The existing catch (AssertionError) only covered assertions being enabled,
which is how the tests ran but not how an application runs. Without -ea the
same call is a SIGSEGV in Java_org_rocksdb_RocksIterator_isValid0Jni that takes
the process down.
hasNext() now returns false once the iterator no longer owns its handle, so it
never touches a closed iterator. One test per class asserts isValid() and
close() are each reached exactly once across two hasNext() calls; all three
fail without the fix.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,11 @@
1
+
## Unreleased
2
+
3
+
### Issue Fixes
4
+
5
+
- Fix JVM crash (SIGSEGV) in the RocksDB backend when a query pages past the end of a collection
6
+
-`EntrySet`, `KeySet` and `ValueSet` close the native `RocksIterator` the first time `hasNext()` answers `false`, but `hasNext()` is idempotent by contract and a second call reached `isValid()` on the freed handle. `BoundedStream`'s skip loop exhausts the iterator and then the caller asks once more, so any `find(..., skipBy(n))` whose skip exceeds the number of remaining records hit it — an ordinary paging request, not an edge case. The existing `catch (AssertionError)` only covered the case where assertions are enabled (`-ea`), which is how the tests ran but not how an application runs: without assertions the same call is a `SIGSEGV` in `Java_org_rocksdb_RocksIterator_isValid0Jni` that takes the whole process down.
7
+
-`hasNext()` now returns `false` when the iterator no longer owns its handle, so it never touches a closed iterator and stays idempotent.
0 commit comments