google / google/googletest

Issue with global mock objects

Open
#1,963 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
39.5k
Forks
10.9k
Avg merge
6d 13h
Merged PRs (30d)
1

Description

I'm experiencing an issue with Gmock when using global mock objects. Basically the tests succeed but the main runner hangs forever when destructing the mock object. Oddly enough this only happens when running it on a docker container but it works just fine on my local machine.

This is the backtrace (and last lines of the execution) after pressing CTRL+C:

```
[----------] Global test environment tear-down
[==========] 4 tests from 1 test case ran. (1 ms total)
[ PASSED ] 4 tests.
^C
Program received signal SIGINT, Interrupt.
0x00007ffff78e2480 in std::_Rb_tree_increment(std::_Rb_tree_node_base*) () from /usr/local/lib64/libstdc++.so.6
(gdb) bt
#0 0x00007ffff78e2480 in std::_Rb_tree_increment(std::_Rb_tree_node_base*) () from /usr/local/lib64/libstdc++.so.6
#1 0x000000000056cee7 in std::_Rb_tree_iterator >::operator++() ()
#2 0x000000000056c568 in testing::Mock::UnregisterLocked(testing::internal::UntypedFunctionMockerBase*) ()
#3 0x000000000050e51b in testing::internal::FunctionMockerBase::~FunctionMockerBase() ()
#4 0x00000000005116a2 in testing::internal::FunctionMocker::~FunctionMocker() ()
#5 0x0000000000511610 in PicmanMock::~PicmanMock() ()
#6 0x00007ffff6fb4940 in __run_exit_handlers (status=0, listp=0x7ffff73185d8 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:83
#7 0x00007ffff6fb499a in __GI_exit (status=) at exit.c:105
#8 0x00007ffff6f9f2e8 in __libc_start_main (main=0x5676b2 , argc=1, argv=0x7fffffffeaf8, init=, fini=, rtld_fini=, stack_end=0x7fffffffeae8)
at ../csu/libc-start.c:325
#9 0x00000000004ed6fa in _start ()
```

I've searched for similar issues online and I saw [this one](https://github.com/google/googlemock/issues/109) but it seems to have already been fixed. I've also checked the related issues but I haven't found a solution yet. Does anyone know what the problem may be?

Please let me know if there is a better place than the repo issues to discuss this.

---
EDIT: I'm using the following versions:
* Google Test: master branch, but same happens with other releases such as 1.8.1 (latest)
* GCC: 8.2.0
* Cmake: 3.12.1

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.