xiedeacc opened a new issue, #2163:
URL: https://github.com/apache/brpc/issues/2163
静态的BvarAdder 变量如果只有一个不会core,但是有多个时,就core了
```
class BvarAdder {
public:
BvarAdder(const std::string& prefix, const std::string& name, int
window_size)
: adders_(), windows_(prefix, name, &adders_, window_size) {}
void operator<<(int64_t n) { adders_ << n; }
private:
bvar::Adder<int64_t> adders_;
bvar::Window<bvar::Adder<int64_t>> windows_;
};
static BvarAdder min_total_statistic;
static BvarAdder fifteen_min_total_statistic;
static BvarAdder hour_total_statistic;
static BvarAdder day_total_statistic;
static void SetTotalStatistic() {
min_total_statistic << 1;
fifteen_min_total_statistic << 1;
hour_total_statistic << 1;
day_total_statistic << 1;
}
```
堆栈
```
1654 external/com_github_google_glog/src/logging.cc: No such file or
directory.
[Current thread is 1 (Thread 0x7f318a446540 (LWP 164298))]
(gdb) bt
#0 0x0000000000ac1d9c in google::LogMessage::Init (this=0x7ffe5ac7b120,
file=<optimized out>, line=181, severity=2, send_method=<optimized out>) at
external/com_github_google_glog/src/logging.cc:1654
#1 0x00000000004b1e90 in bvar::detail::ReducerSampler<bvar::Reducer<long,
bvar::detail::AddTo<long>, bvar::detail::MinusFrom<long> >, long,
bvar::detail::AddTo<long>, bvar::detail::MinusFrom<long> >::set_window_size
(window_size=<optimized out>, this=<optimized out>)
at external/brpc/src/butil/synchronization/lock.h:79
#2 bvar::detail::WindowBase<bvar::Adder<long>,
(bvar::SeriesFrequency)0>::WindowBase (this=0x13219f8
<wifi::ad::anonymous::util::StatisticVar::day_total_statistic+152>,
var=<optimized out>, window_size=<optimized out>) at
external/brpc/src/bvar/window.h:84
#3 0x00000000004b4f27 in bvar::Window<bvar::Adder<long>,
(bvar::SeriesFrequency)0>::Window (window_size=86400, var=0x1321960
<wifi::ad::anonymous::util::StatisticVar::day_total_statistic>, name=...,
this=0x13219f8
<wifi::ad::anonymous::util::StatisticVar::day_total_statistic+152>)
at external/brpc/src/butil/synchronization/lock.h:51
#4 wifi::ad::anonymous::util::BvarAdder::BvarAdder (this=0x1321960
<wifi::ad::anonymous::util::StatisticVar::day_total_statistic>, prefix=...,
name=..., window_size=86400) at ./src/util/statistic_var.h:45
#5 0x0000000000462416 in __static_initialization_and_destruction_0
(__priority=65535, __initialize_p=1) at
/usr/local/lib/gcc/x86_64-linux-gnu/11.3.0/../../../../include/c++/11.3.0/bits/char_traits.h:399
#6 0x0000000000462f09 in
_GLOBAL__sub_I__ZN4wifi2ad9anonymous4util12StatisticVar6prefixB5cxx11E () at
src/util/statistic_var.cc:101
#7 0x0000000000baf3fd in __libc_csu_init ()
#8 0x00007f3188ce2ed5 in __libc_start_main (main=0x459240 <main(int,
char**)>, argc=2, argv=0x7ffe5ac7b358, init=0xbaf3b0 <__libc_csu_init>,
fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffe5ac7b348) at
libc-start.c:246
#9 0x000000000047b7cc in _start () at src/anonymous.cc:79
(gdb) q
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]