Closed gou4shi1 closed 2 years ago
Static/global absl::Mutex
objects either need to be absl::kConstInit
, or you have to use a safe idiom like
absl::Mutex& GetGlobalMutex() {
static absl::Mutex* mu = new absl::Mutex;
return *mu;
}
Thanks for the reply, but in this case, the mutex is a member var of a class, and the static obj of that class is init with safe idiom, the problem is that it also calls a func other than ctor and the mutex is locked in that func
We need a complete reproduction before we can investigate.
Describe the bug I know that static init order is eval, but my company project has copy-and-pasted some files from tensorflow long time ago, if I replace the mutex in the link with
absl::Mutex
, ASAN fail:Steps to reproduce the bug
bazel test -c dbg --config asan
in my project.What version of Abseil are you using? lts_2020_02_25
What operating system and version are you using Linux 4.10.0-42-generic Ubuntu 16.04.1
What compiler and version are you using?
What build system are you using? bazel 3.7.2