Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Segfault in mutex.h #1672

Open
benjaminmordaunt opened this issue Sep 28, 2023 · 3 comments
Open

[BUG] Segfault in mutex.h #1672

benjaminmordaunt opened this issue Sep 28, 2023 · 3 comments
Labels
incomplete work needed

Comments

@benjaminmordaunt
Copy link

Describe the bug
I'm getting a null dereference within class Barrier for a trivial use-case example.

System
Which OS, compiler, and compiler version are you using:

  • OS: Linux x86_64 Ubuntu 20.04 LTS
  • Compiler and version: All I've tried (GCC 9.0 - 12.3), Clang 12

To reproduce

Simple reproducer:

void benchmark_no_op(benchmark::State& state) {
    for (auto _ : state) {
         std::this_thread::sleep_for(std::chrono::milliseconds(1000));
    }
}

// Register the benchmarks.
BENCHMARK(benchmark_no_op);

// Run the benchmarks.
BENCHMARK_MAIN();

Expected behavior
No runtime segmentation fault.

Screenshots
image

Stack trace:

#0  0x0000000000000000 in ?? ()
#1  0x000000000048416d in std::condition_variable::notify_all() ()
#2  0x000000000040923d in wait (this=0x6c4ee0)
#3  0x0000000000409588 in StartStopBarrier (this=0x6c4e10)
#4  0x000000000040a95b in StartKeepRunning (this=0x7fffffffa7f0)
#5  0x00000000004055ae in benchmark_no_op (state=...)
#6  0x000000000042020e in benchmark::internal::FunctionBenchmark::Run (this=0x6b1fe0, st=...)
#7  0x00000000004762e3 in Run (this=0x6c43e0, iters=1, thread_id=0, timer=0x7fffffffa7c0,
#8  0x000000000045454b in RunInThread (b=0x6c43e0, iters=1, thread_id=0, manager=0x6c4e10,
#9  0x000000000045541a in DoNIterations (this=0x6c4d30)
#10 0x0000000000455e6d in DoOneRepetition (this=0x6c4d30)
#11 0x000000000040b6c9 in RunBenchmarks (benchmarks=..., display_reporter=0x6b2110, file_reporter=0x0)
#12 0x000000000040c614 in RunSpecifiedBenchmarks (display_reporter=0x6b2110, file_reporter=0x0,
#13 0x000000000040be13 in RunSpecifiedBenchmarks ()
#14 0x0000000000405700 in main (argc=1, argv=0x7fffffffddb8)

Additional context
Add any other context about the problem here.

@LebedevRI
Copy link
Collaborator

Can not reproduce.
There must be something weird going on.
Can you please try building benchmark from git manually,
does the issue manifest then too?

@LebedevRI LebedevRI added the incomplete work needed label Sep 28, 2023
@benjaminmordaunt
Copy link
Author

Hi, this seems to have something to do with static linkage, as without -static in target_link_libraries, this issue does not present.

@LebedevRI
Copy link
Collaborator

Unfortunately that did not help, still does not reproduce for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
incomplete work needed
Projects
None yet
Development

No branches or pull requests

2 participants