This is an automated email from the ASF dual-hosted git repository.
jbonofre pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-java.git
The following commit(s) were added to refs/heads/main by this push:
new a62942c0c GH-1385: Match the JNI return type when closing exported C
Data (#1390)
a62942c0c is described below
commit a62942c0c8ab73e7a86236c8d19321c7aebe07ff
Author: Tiefang Hu <[email protected]>
AuthorDate: Sun Nov 15 14:59:45 2026 +0800
GH-1385: Match the JNI return type when closing exported C Data (#1390)
## What's Changed
The C Data release callbacks invoke `PrivateData.close()` through
`CallObjectMethod`, although its JNI descriptor is `()V`. With OpenJ9's
JNI checks enabled, releasing an exported array, schema or stream can
abort the JVM. Use `CallVoidMethod` in both callbacks.
The existing C Data tests already exercise the affected callbacks, so
this PR adds no new test suite.
Validation:
- Linux aarch64, IBM Semeru OpenJ9 21.0.12.1, `-Xcheck:jni`: the
existing `RoundtripTest#testSchema` and `StreamTest#getSchemaError` each
abort with `JVMJNCK046E` against the unchanged JNI library (exit 87, at
`releaseSchema` and `releaseArrayStream` respectively). Both pass
against the fixed library without JNI check errors.
- macOS arm64, JDK 21: affected C Data reactor `clean verify` passed:
110 C Data cases, no failures or skips; vector and memory dependencies
passed as well.
Closes #1385.
AI-generated PR description. Investigation, implementation and automated
review assisted by Codex and DeepSeek.
---
c/src/main/cpp/jni_wrapper.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/c/src/main/cpp/jni_wrapper.cc b/c/src/main/cpp/jni_wrapper.cc
index 3d7a19456..4441706ac 100644
--- a/c/src/main/cpp/jni_wrapper.cc
+++ b/c/src/main/cpp/jni_wrapper.cc
@@ -170,7 +170,7 @@ void release_exported(T* base) {
JNIEnvGuard guard(private_data->vm_);
JNIEnv* env = guard.env();
- env->CallObjectMethod(private_data->j_private_data_,
kPrivateDataCloseMethod);
+ env->CallVoidMethod(private_data->j_private_data_,
kPrivateDataCloseMethod);
if (env->ExceptionCheck()) {
// Can't signal this to caller, so log and then try to free things
// as best we can
@@ -295,7 +295,7 @@ void ArrowArrayStreamRelease(ArrowArrayStream* stream) {
JNIEnvGuard guard(private_data->vm_);
JNIEnv* env = guard.env();
- env->CallObjectMethod(private_data->j_private_data_,
kPrivateDataCloseMethod);
+ env->CallVoidMethod(private_data->j_private_data_,
kPrivateDataCloseMethod);
if (env->ExceptionCheck()) {
env->ExceptionDescribe();
env->ExceptionClear();