Describe the bug
AgentCombiner类继承自enable_shared_from_this,内部会有一个weak_ptr成员,这个成员是在对象被第一个std::shared_ptr管理时才会被初始化,相当于必须要有make_shared出来的shared_ptr管理才能正常使用weak_ptr成员,所以在类似偶发的Reducer对象/IntRecorder对象/Percentile对象 销毁后或初始化前(没有shared_ptr管理weak_ptr成员)再调用该类的operator<<函数录入样本数据, operator<<函数调用_combiner->get_or_create_tls_agent(),_combiner->get_or_create_tls_agent()再调用this->shared_from_this()就会报错bad_weak_ptr
所以长时间重复执行下述命令就会偶发报错bad_weak_ptr
taskset -c 0-95 ./kpl_tools server -use_rdma 0 -thread_num 96
taskset -c 48-95 ./kpl_tools client -thread_num 48 -queue_depth 85 -attachment_size 131072 -use_rdma 0 -connection_type pooled
terminate called after throwing an instance if 'std::bad_weak_ptr'
what(): bad_weak_ptr
Aborted (core dumped)
To Reproduce
在两个shell窗口分别执行如下命令:
taskset -c 0-95 ./kpl_tools server -use_rdma 0 -thread_num 96
taskset -c 48-95 ./kpl_tools client -thread_num 48 -queue_depth 85 -attachment_size 131072 -use_rdma 0 -connection_type pooled
Expected behavior
预期长时间重复执行上述命令不会偶发报错bad_weak_ptr
Versions
OS: openEuler 24.03 (LTS-SP2)
Compiler: gcc 12.3.1
brpc: 1.16
protobuf: protobuf-25.1-12.oe2403sp2.aarch64
Additional context/screenshots
Describe the bug
AgentCombiner类继承自enable_shared_from_this,内部会有一个weak_ptr成员,这个成员是在对象被第一个std::shared_ptr管理时才会被初始化,相当于必须要有make_shared出来的shared_ptr管理才能正常使用weak_ptr成员,所以在类似偶发的Reducer对象/IntRecorder对象/Percentile对象 销毁后或初始化前(没有shared_ptr管理weak_ptr成员)再调用该类的operator<<函数录入样本数据, operator<<函数调用_combiner->get_or_create_tls_agent(),_combiner->get_or_create_tls_agent()再调用this->shared_from_this()就会报错bad_weak_ptr
所以长时间重复执行下述命令就会偶发报错bad_weak_ptr
taskset -c 0-95 ./kpl_tools server -use_rdma 0 -thread_num 96
taskset -c 48-95 ./kpl_tools client -thread_num 48 -queue_depth 85 -attachment_size 131072 -use_rdma 0 -connection_type pooled
terminate called after throwing an instance if 'std::bad_weak_ptr'
what(): bad_weak_ptr
Aborted (core dumped)
To Reproduce
在两个shell窗口分别执行如下命令:
taskset -c 0-95 ./kpl_tools server -use_rdma 0 -thread_num 96
taskset -c 48-95 ./kpl_tools client -thread_num 48 -queue_depth 85 -attachment_size 131072 -use_rdma 0 -connection_type pooled
Expected behavior
预期长时间重复执行上述命令不会偶发报错bad_weak_ptr
Versions
OS: openEuler 24.03 (LTS-SP2)
Compiler: gcc 12.3.1
brpc: 1.16
protobuf: protobuf-25.1-12.oe2403sp2.aarch64
Additional context/screenshots