This is an automated email from the ASF dual-hosted git repository. stigahuang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/impala.git
commit 3d57e4d05e4b9d7601eadfdd7eb442b13241a49f Author: Surya Hebbar <[email protected]> AuthorDate: Thu Feb 27 19:38:36 2025 +0530 IMPALA-13805: Fix TSAN build failures for the runtime-profile-test The shared memory of a rapidjson document's value containing event sequences was being utilized through a reference pointer, instead of referencing by value, while generating the aggregated event sequences. During thread sanitization builds, such values were cleared, resulting in test failures. This has been fixed by correctly passing values through reference, instead of the shared memory address. Tested locally by building with TSAN opts. Change-Id: Ibdea503d032d456746e9cb4f19d0057197ddb117 Reviewed-on: http://gerrit.cloudera.org:8080/22560 Reviewed-by: Impala Public Jenkins <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> --- be/src/util/runtime-profile.cc | 8 +++----- be/src/util/runtime-profile.h | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/be/src/util/runtime-profile.cc b/be/src/util/runtime-profile.cc index fc053b4d5..f36c7a42e 100644 --- a/be/src/util/runtime-profile.cc +++ b/be/src/util/runtime-profile.cc @@ -2972,10 +2972,10 @@ void AggregatedRuntimeProfile::ToJsonSubclass( if (es_count > 0) { Value event_sequences_json(kArrayType); - Value* event_sequence_json; for (AggEventSequence& agg_event_sequence : agg_event_sequences) { + Value event_sequence_json(kObjectType); agg_event_sequence.ToJson(event_sequence_json, d); - event_sequences_json.PushBack(*event_sequence_json, allocator); + event_sequences_json.PushBack(event_sequence_json, allocator); } parent->AddMember("event_sequences", event_sequences_json, allocator); } @@ -3001,7 +3001,7 @@ void AggregatedRuntimeProfile::ToJsonSubclass( } } -void AggregatedRuntimeProfile::AggEventSequence::ToJson(Value*& val, +void AggregatedRuntimeProfile::AggEventSequence::ToJson(Value& event_sequence_json, rapidjson::Document* d) { Document::AllocatorType& allocator = d->GetAllocator(); @@ -3068,7 +3068,6 @@ void AggregatedRuntimeProfile::AggEventSequence::ToJson(Value*& val, static vector<size_t> inst_count_list(BUCKET_SIZE); // Perform aggregation to limit the size and complexity of event sequences JSON - Value event_sequence_json(kObjectType); Value events_json(kArrayType); if (num_instances <= BUCKET_SIZE || BUCKET_SIZE == 0) { // Group event timestamps, when number of instances is less than bucket size @@ -3165,7 +3164,6 @@ void AggregatedRuntimeProfile::AggEventSequence::ToJson(Value*& val, event_sequence_json.AddMember("unreported_event_instance_idxs", missing_event_instance_idxs, allocator); } - val = &event_sequence_json; } void AggregatedRuntimeProfile::CollectInfoStringIntoJson(const string& info_string_name, diff --git a/be/src/util/runtime-profile.h b/be/src/util/runtime-profile.h index 882ba5701..476357427 100644 --- a/be/src/util/runtime-profile.h +++ b/be/src/util/runtime-profile.h @@ -944,7 +944,7 @@ class AggregatedRuntimeProfile : public RuntimeProfileBase { std::vector<std::vector<int64_t>> timestamps; // Builds the JSON for the aggregate event sequence's metrics into the provided 'val' - void ToJson(rapidjson::Value*& val, rapidjson::Document* d); + void ToJson(rapidjson::Value& event_sequence_json, rapidjson::Document* d); }; // Map containing event sequences, with its type in string format as the key
