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 b12e3ce2a6d [bug](cherry-pick) Fix coredump in aggregation node's
destruction #28684 (#28987)
b12e3ce2a6d is described below
commit b12e3ce2a6de95b598a0648d587f2ddf885aa61a
Author: xy720 <[email protected]>
AuthorDate: Mon Dec 25 23:10:17 2023 +0800
[bug](cherry-pick) Fix coredump in aggregation node's destruction #28684
(#28987)
---
be/src/vec/exec/vaggregation_node.cpp | 31 +++++++++++++++++++------------
1 file changed, 19 insertions(+), 12 deletions(-)
diff --git a/be/src/vec/exec/vaggregation_node.cpp
b/be/src/vec/exec/vaggregation_node.cpp
index 19f5ce48173..4b19474c358 100644
--- a/be/src/vec/exec/vaggregation_node.cpp
+++ b/be/src/vec/exec/vaggregation_node.cpp
@@ -950,18 +950,25 @@ void
AggregationNode::_emplace_into_hash_table(AggregateDataPtr* places, ColumnR
auto creator = [this](const auto& ctor, const auto& key) {
using KeyType = std::decay_t<decltype(key)>;
- if constexpr
(HashTableTraits<HashTableType>::is_string_hash_table &&
- !std::is_same_v<StringRef, KeyType>) {
- StringRef string_ref = to_string_ref(key);
- ArenaKeyHolder key_holder {string_ref,
*_agg_arena_pool};
- key_holder_persist_key(key_holder);
- auto mapped =
_aggregate_data_container->append_data(key_holder.key);
- _create_agg_status(mapped);
- ctor(key, mapped);
- } else {
- auto mapped =
_aggregate_data_container->append_data(key);
- _create_agg_status(mapped);
- ctor(key, mapped);
+ try {
+ if constexpr
(HashTableTraits<HashTableType>::is_string_hash_table &&
+ !std::is_same_v<StringRef, KeyType>) {
+ StringRef string_ref = to_string_ref(key);
+ ArenaKeyHolder key_holder {string_ref,
*_agg_arena_pool};
+ key_holder_persist_key(key_holder);
+ auto mapped =
_aggregate_data_container->append_data(key_holder.key);
+ _create_agg_status(mapped);
+ ctor(key, mapped);
+ } else {
+ auto mapped =
_aggregate_data_container->append_data(key);
+ _create_agg_status(mapped);
+ 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;
}
};
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]