ThreadSanitizer: std::localtime() is not thread-safe. #4303
Labels
help wanted
Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
severity/minor
type/bug
The issue is confirmed as a bug.
Bug Report
ThreadSanitizer reports that
DB::UnifiedLogPatternFormatter::getTimestamp()
has data race.Following the code,
std::localtime()
which called byDB::UnifiedLogPatternFormatter::getTimestamp()
is not thread-safe and I think this is the problem.I think we should use
localtime_r()
to replacestd::localtime()
.The text was updated successfully, but these errors were encountered: