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

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


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

commit 363721e066ec5e858c16d3ff37e599c1366489bd
Author: zhangstar333 <[email protected]>
AuthorDate: Sat Dec 9 11:00:30 2023 +0800

    [Bug](udf) java-udf function open failed cause BE core dump #28063
    
    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 751bbdbe55a..0ae649b768d 100644
--- a/be/src/vec/functions/function_java_udf.cpp
+++ b/be/src/vec/functions/function_java_udf.cpp
@@ -83,6 +83,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 a30a93b355e..bb493aa7ed4 100644
--- a/be/src/vec/functions/function_java_udf.h
+++ b/be/src/vec/functions/function_java_udf.h
@@ -123,10 +123,15 @@ private:
         jmethodID executor_close_id;
         jobject executor = nullptr;
         bool is_closed = false;
+        bool open_successes = false;
 
         JniContext() = default;
 
         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