Describe the bug
We encountered an unexpected failure in ASAN mode when using BRPC 1.13.0. A simple testing program reports
Tracer caught signal 11: addr=0x7f2cb17fd000 pc=0x7f2cb6c9c7e8 sp=0x7f2caccf0d20
==2075==LeakSanitizer has encountered a fatal error.
==2075==HINT: For debugging, try setting environment variable LSAN_OPTIONS=verbosity=1:log_threads=1
==2075==HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc)
Meanwhile, the same program runs well with BRPC 1.11.0 using exactly the same compilation and invocation commands.
To Reproduce
I have minimized the reproduction into the following code, in BRPC repository workspace, create the following files.
xxx/xxx.cc
#include <vector>
#include "bthread/bthread.h"
#include "butil/logging.h"
static void* Worker(void* argument) {
for (int k = 0; k < 10; ++k) {
LOG(WARNING) << "XXX: " << k;
bthread_usleep(30000);
}
return nullptr;
}
int main() {
bthread_setconcurrency(10);
std::vector<bthread_t> workers;
for (int k = 0; k < 3; ++k) {
bthread_start_background(&workers.emplace_back(), nullptr, &Worker, nullptr);
}
for (const auto& worker : workers) {
bthread_join(worker, nullptr);
}
}
xxx/BUILD
cc_binary(
name = "xxx",
srcs = ["xxx.cc"],
deps = [
"//:brpc",
],
)
Then run with bazel run -c fastbuild --copt=-fsanitize=address --linkopt=-fsanitize=address --linkopt=-lunwind //xxx:xxx.
Note that when using BRPC 1.13.0 you may need to revise the BUILD.bazel file which has some minor BzlMod only callsites, if you are not using BzlMod. However, apparently this has nothing to do with the issue itself.
Expected behavior
Example program runs well with no ASAN or LSAN findings.
Versions
OS: Ubuntu 22.04
Compiler: gcc 11, gcc 12, clang 16, clang 18, clang 20
brpc: 1.13.0 (Problematic), 1.11.0 (Working)
protobuf: Unrelated (Example programs runs with the version each BRPC release specifies)
Additional context/screenshots
Maybe PR #2858 (released in BRPC 1.12.0) has something to do with this --- the LSAN messages disappeared when I hacked off the detection of BUTIL_USE_ASAN macro.
Describe the bug
We encountered an unexpected failure in ASAN mode when using BRPC 1.13.0. A simple testing program reports
Meanwhile, the same program runs well with BRPC 1.11.0 using exactly the same compilation and invocation commands.
To Reproduce
I have minimized the reproduction into the following code, in BRPC repository workspace, create the following files.
xxx/xxx.ccxxx/BUILDThen run with
bazel run -c fastbuild --copt=-fsanitize=address --linkopt=-fsanitize=address --linkopt=-lunwind //xxx:xxx.Note that when using BRPC 1.13.0 you may need to revise the
BUILD.bazelfile which has some minor BzlMod only callsites, if you are not using BzlMod. However, apparently this has nothing to do with the issue itself.Expected behavior
Example program runs well with no ASAN or LSAN findings.
Versions
OS: Ubuntu 22.04
Compiler: gcc 11, gcc 12, clang 16, clang 18, clang 20
brpc: 1.13.0 (Problematic), 1.11.0 (Working)
protobuf: Unrelated (Example programs runs with the version each BRPC release specifies)
Additional context/screenshots
Maybe PR #2858 (released in BRPC 1.12.0) has something to do with this --- the LSAN messages disappeared when I hacked off the detection of
BUTIL_USE_ASANmacro.