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

xuyang 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 504693be7f8 [bug](coredump) Fix coredump in aggregation node's 
destruction(#28684)
504693be7f8 is described below

commit 504693be7f890392035022739f0933b611a833e2
Author: xy720 <22125576+xy...@users.noreply.github.com>
AuthorDate: Wed Dec 20 20:02:48 2023 +0800

    [bug](coredump) Fix coredump in aggregation node's destruction(#28684)
    
    fix coredump in aggregation node's destruction
---
 be/src/vec/exec/vaggregation_node.cpp | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/be/src/vec/exec/vaggregation_node.cpp 
b/be/src/vec/exec/vaggregation_node.cpp
index c594e99d02d..69a50ba891b 100644
--- a/be/src/vec/exec/vaggregation_node.cpp
+++ b/be/src/vec/exec/vaggregation_node.cpp
@@ -847,13 +847,20 @@ void 
AggregationNode::_emplace_into_hash_table(AggregateDataPtr* places, ColumnR
                 agg_method.init_serialized_keys(key_columns, num_rows);
 
                 auto creator = [this](const auto& ctor, auto& key, auto& 
origin) {
-                    HashMethodType::try_presis_key(key, origin, 
*_agg_arena_pool);
-                    auto mapped = 
_aggregate_data_container->append_data(origin);
-                    auto st = _create_agg_status(mapped);
-                    if (!st) {
-                        throw Exception(st.code(), st.to_string());
+                    try {
+                        HashMethodType::try_presis_key(key, origin, 
*_agg_arena_pool);
+                        auto mapped = 
_aggregate_data_container->append_data(origin);
+                        auto st = _create_agg_status(mapped);
+                        if (!st) {
+                            throw Exception(st.code(), st.to_string());
+                        }
+                        ctor(key, mapped);
+                    } catch (...) {
+                        // Exception-safety - if it can not allocate memory or 
create status,
+                        // the destructors will not be called.
+                        ctor(key, nullptr);
+                        throw;
                     }
-                    ctor(key, mapped);
                 };
 
                 auto creator_for_null_key = [this](auto& mapped) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to