This is an automated email from the ASF dual-hosted git repository.

kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 8995057f628 [Bug](udf) java-udf function open failed cause BE core 
dump #28063 (#28462)
8995057f628 is described below

commit 8995057f6285206ec1bc62d18d834bbcbaa26778
Author: zhangstar333 <[email protected]>
AuthorDate: Sat Dec 16 09:45:25 2023 +0800

    [Bug](udf) java-udf function open failed cause BE core dump #28063 (#28462)
    
    when the java-udf open function failed, and some JNI have not set,
    so in close function can't call jni.
---
 be/src/vec/functions/function_java_udf.cpp | 1 +
 be/src/vec/functions/function_java_udf.h   | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/be/src/vec/functions/function_java_udf.cpp 
b/be/src/vec/functions/function_java_udf.cpp
index 331bb1bcac7..242f22a2091 100644
--- a/be/src/vec/functions/function_java_udf.cpp
+++ b/be/src/vec/functions/function_java_udf.cpp
@@ -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();
 }
diff --git a/be/src/vec/functions/function_java_udf.h 
b/be/src/vec/functions/function_java_udf.h
index d05e2e581f1..447ea18e89d 100644
--- a/be/src/vec/functions/function_java_udf.h
+++ b/be/src/vec/functions/function_java_udf.h
@@ -144,11 +144,16 @@ private:
         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;
             }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to