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

gabriellee 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 7f2fda8ad94 [expr](fix) Not to throw exception when close failed 
(#32287)
7f2fda8ad94 is described below

commit 7f2fda8ad9444cd563d815c962d05005a33e60ef
Author: Gabriel <[email protected]>
AuthorDate: Wed Mar 20 18:39:23 2024 +0800

    [expr](fix) Not to throw exception when close failed (#32287)
---
 be/src/vec/exprs/vexpr.cpp         | 6 +++---
 be/src/vec/exprs/vexpr_context.cpp | 6 +++++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/be/src/vec/exprs/vexpr.cpp b/be/src/vec/exprs/vexpr.cpp
index 007d2b9991a..c0f0eb07612 100644
--- a/be/src/vec/exprs/vexpr.cpp
+++ b/be/src/vec/exprs/vexpr.cpp
@@ -542,10 +542,10 @@ void VExpr::close_function_context(VExprContext* context, 
FunctionContext::Funct
                                    const FunctionBasePtr& function) const {
     if (_fn_context_index != -1) {
         FunctionContext* fn_ctx = context->fn_context(_fn_context_index);
-        // close failed will make system unstable. dont swallow it.
-        THROW_IF_ERROR(function->close(fn_ctx, FunctionContext::THREAD_LOCAL));
+        // `close_function_context` is called in VExprContext's destructor so 
do not throw exceptions here.
+        static_cast<void>(function->close(fn_ctx, 
FunctionContext::THREAD_LOCAL));
         if (scope == FunctionContext::FRAGMENT_LOCAL) {
-            THROW_IF_ERROR(function->close(fn_ctx, 
FunctionContext::FRAGMENT_LOCAL));
+            static_cast<void>(function->close(fn_ctx, 
FunctionContext::FRAGMENT_LOCAL));
         }
     }
 }
diff --git a/be/src/vec/exprs/vexpr_context.cpp 
b/be/src/vec/exprs/vexpr_context.cpp
index 7325ba5f315..cdbf22a7209 100644
--- a/be/src/vec/exprs/vexpr_context.cpp
+++ b/be/src/vec/exprs/vexpr_context.cpp
@@ -42,7 +42,11 @@ VExprContext::~VExprContext() {
     if (!_prepared || !_opened) {
         return;
     }
-    close();
+    try {
+        close();
+    } catch (const Exception& e) {
+        LOG(WARNING) << "Exception occurs when expr context deconstruct: " << 
e.to_string();
+    }
 }
 
 Status VExprContext::execute(vectorized::Block* block, int* result_column_id) {


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

Reply via email to