Skip to content

Release JNI event listener array elements - #15053

Open
fyrsta7 wants to merge 1 commit into
facebook:mainfrom
fyrsta7:fix/release-jni-event-listeners
Open

Release JNI event listener array elements#15053
fyrsta7 wants to merge 1 commit into
facebook:mainfrom
fyrsta7:fix/release-jni-event-listeners

Conversation

@fyrsta7

@fyrsta7 fyrsta7 commented Aug 4, 2026

Copy link
Copy Markdown

Summary

Fixes #14972 by releasing the jlongArray elements acquired while copying Java event listeners into native shared pointers.

Details

rocksdb_set_event_listeners_helper calls GetLongArrayElements to read the listener handles, but did not release the returned pointer after copying the values. This adds the matching ReleaseLongArrayElements call with JNI_ABORT, since the native code does not modify the Java array.

Validation

I built RocksJava and ran the repository's Java test runner with JNI checking enabled:

JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 make -j8 rocksdbjava
JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 \
  make -C java run_test \
  ALL_JAVA_TESTS='org.rocksdb.OptionsTest org.rocksdb.DBOptionsTest'

OptionsTest (141 tests), DBOptionsTest (84 tests), and the runner's StatisticsTest (8 tests) all passed with no failures or errors. Both options test classes exercise setListeners and listeners, including replacing a non-empty listener list with an empty list.

@meta-cla meta-cla Bot added the CLA Signed label Aug 4, 2026
@fyrsta7
fyrsta7 marked this pull request as ready for review August 8, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

setEventListeners never releases the GetLongArrayElements pointer

1 participant