Open
Description
The code in [1] calls std::localtime
, which might not thread safe [2]. Sample as
WARNING: ThreadSanitizer: data race (pid=119895)
Write of size 8 at 0x7b04000007d0 by thread T50:
#0 free /home/admin/llvm/llvm-project-17.0.3.src/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:722:3 (cz_fs_unittest+0x28fba05)
#1 tzset_internal /home/lyukefan/deps/glibc-2.18/time/tzset.c:440:3 (libc.so.6+0xab3da)
#2 qcloud_cos::LogUtil::GetLogPrefix(int) <null> (cz_fs_unittest+0x3526295)
Previous write of size 8 at 0x7b04000007d0 by thread T65:
#0 malloc /home/admin/llvm/llvm-project-17.0.3.src/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:663:5 (cz_fs_unittest+0x28fb2ac)
#1 __strdup /home/lyukefan/deps/glibc-2.18/string/strdup.c:42:15 (libc.so.6+0x84a7a)
#2 qcloud_cos::LogUtil::GetLogPrefix(int)
[1] https://github.com/tencentyun/cos-cpp-sdk-v5/blob/549a3affecc0d851a8947b9684c2a09e458aadf8/src/util/log_util.cpp#L20C47-L20C62
[2] https://github.com/tencentyun/cos-cpp-sdk-v5/blob/549a3affecc0d851a8947b9684c2a09e458aadf8/src/util/log_util.cpp#L20C47-L20C62
Metadata
Metadata
Assignees
Labels
No labels