Skip to content

Conversation

ckennelly
Copy link
Contributor

RunSpecifiedBenchmarks destroys benchmark_mutex before its last usage, typically in RemoveBenchmark during cleanup of the BenchmarkFamilies singleton.

When compiled with -fsanitize=thread with Clang, benchmark_test emits an error during shutdown:

ThreadSanitizer WARNING: unlock of unlocked mutex                                  
    #0 pthread_mutex_unlock ??:0 (exe+0x00000003c44c)                              
    #1 ~mutex_lock /home/ckennelly/projects/benchmark/src/mutex_lock.h:13 (exe+0x000000096793)
    #2 ~mutex_lock /home/ckennelly/projects/benchmark/src/mutex_lock.h:13 (exe+0x00000007f4f0)
    #3 benchmark::internal::BenchmarkFamilies::RemoveBenchmark(int) /home/ckennelly/projects/benchmark/src/benchmark.cc:343 (exe+0x000000073ddd)
    #4 ~Benchmark /home/ckennelly/projects/benchmark/src/benchmark.cc:695 (exe+0x000000077fbe)
    #5 ~BenchmarkFamilies /home/ckennelly/projects/benchmark/src/benchmark.cc:324 (exe+0x000000073ac5)
    #6 __libc_secure_getenv ??:0 (libc.so.6+0x000000037c88)

RunSpecifiedBenchmarks destroys benchmark_mutex before its last usage,
typically in RemoveBenchmark during cleanup of the BenchmarkFamilies singleton.
dmah42 pushed a commit that referenced this pull request May 5, 2014
Statically initialize benchmark_mutex and extend its lifetime.
@dmah42 dmah42 merged commit 46507cb into google:master May 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants