[YSQL][PgstatCollector][TSan] ThreadSanitizer: data race in reaper #11702
Open
Description
Jira Link: DB-944
Description
Similar to #11701 , but happens not during cancel but with reaper:
WARNING: ThreadSanitizer: data race (pid=14841)
Read of size 4 at 0x7fe21a843714 by thread T1:
#0 pgstat_start <null> (postgres+0xa0dccf)
#1 reaper <null> (postgres+0xa48307)
#2 __tsan::CallUserSignalHandler(__tsan::ThreadState*, bool, bool, bool, int, __sanitizer::__sanitizer_siginfo*, void*) <null> (postgres+0x4ca7b0)
#3 ServerLoop <null> (libyrpc.so+0x1aeec5)
#4 PostmasterMain <null> (libyrpc.so+0x1af0dd)
#5 PostgresServerProcessMain <null> (libyrpc.so+0x1b1445)
#6 boost::asio::detail::scheduler::run(boost::system::error_code&) <null> (libyrpc.so+0x1b1104)
#7 main <null> (libyrpc.so+0x1b3ada)
#8 realloc <null> (libyrpc.so+0x1ac551)
#9 read_alias_file <null> (libyrpc.so+0x1b3088)
#10 useful_strerror <null> (libyrpc.so+0x1b2f8d)
#11 expand_fmt_string <null> (libserver_process.so+0x96004)
#12 errmsg <null> (libyb_util.so+0x3d7389)
#13 pgstat_read_statsfiles <null> (postgres+0x4c4052)
Previous write of size 4 at 0x7fe21a843714 by main thread:
[failed to restore the stack]
Location is global '__tsan::CallUserSignalHandler(__tsan::ThreadState*, bool, bool, bool, int, __sanitizer::__sanitizer_siginfo*, void*)' at 0x7fe2116cf000 (zero (deleted)+0x000009174714)
Thread T1 'iotp_pggate_ybc' (tid=14844, running) created by main thread at:
#0 realloc <null> (postgres+0x4c40d5)
#1 yb::rpc::IoThreadPool::IoThreadPool(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned long) <null> (libyb_util.so+0x3d6b93)
#2 yb::rpc::Messenger::Messenger(yb::rpc::MessengerBuilder const&) <null> (libyrpc.so+0x1ac3c0)
#3 yb::rpc::IoThreadPool::Impl::Impl(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned long) <null> (libyrpc.so+0x1abd8c)
#4 yb::rpc::MessengerBuilder::Build() <null> (libyrpc.so+0x1abb07)
#5 PgstatCollectorMain <null> (libyrpc.so+0x1b7e57)
#6 pgstat_start <null> (libyrpc.so+0x1b4a4a)
#7 reaper <null> (libyb_client.so+0x3e97dc)
#8 __tsan::CallUserSignalHandler(__tsan::ThreadState*, bool, bool, bool, int, __sanitizer::__sanitizer_siginfo*, void*) <null> (libyb_pggate.so+0xcc931)
#9 ServerLoop <null> (libyb_pggate.so+0xcc5f7)
#10 PostmasterMain <null> (libyb_pggate.so+0xba798)
#11 PostgresServerProcessMain <null> (libyb_pggate.so+0xbaa37)
#12 YBInitPostgresBackend <null> (postgres+0xc2b3ec)
#13 InitPostgres <null> (postgres+0xc08f5c)
#14 main <null> (postgres+0xa499aa)
#15 realloc <null> (postgres+0x9804b5)
#16 read_alias_file <null> (postgres+0x97f8b6)
#17 useful_strerror <null> (postgres+0x97e6b0)
#18 expand_fmt_string <null> (postgres+0x97b693)
#19 errmsg <null> (postgres+0x88b017)
#20 pgstat_read_statsfiles <null> (postgres+0x88b421)