Skip to content

Commit

Permalink
[Bug](udf) java-udf function open failed cause BE core dump apache#28063
Browse files Browse the repository at this point in the history


when the java-udf open function failed, and some JNI have not set,
so in close function can't call jni.
  • Loading branch information
zhangstar333 committed Dec 15, 2023
1 parent bde9dc9 commit 6591676
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions be/src/vec/functions/function_java_udf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ Status JavaFunctionCall::open(FunctionContext* context, FunctionContext::Functio
}
RETURN_ERROR_IF_EXC(env);
RETURN_IF_ERROR(JniUtil::LocalToGlobalRef(env, jni_ctx->executor, &jni_ctx->executor));
jni_ctx->open_successes = true;
}
return Status::OK();
}
Expand Down
5 changes: 5 additions & 0 deletions be/src/vec/functions/function_java_udf.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,16 @@ class JavaFunctionCall : public IFunctionBase {
jmethodID executor_close_id_;
jobject executor = nullptr;
bool is_closed = false;
bool open_successes = false;

JniContext(int64_t num_args, jclass executor_cl, jmethodID executor_close_id)
: executor_cl_(executor_cl), executor_close_id_(executor_close_id) {}

void close() {
if (!open_successes) {
LOG_WARNING("maybe open failed, need check the reason");
return; //maybe open failed, so can't call some jni
}
if (is_closed) {
return;
}
Expand Down

0 comments on commit 6591676

Please sign in to comment.