-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
[cmake] Fix tests (/ static initialization order) #9146
Conversation
makes sense. i never saw this in my fork since rarmanager is gone. |
@@ -35,6 +35,10 @@ | |||
#include "interfaces/python/XBPython.h" | |||
#endif | |||
|
|||
// Guarantee that CSpecialProtocol is initialized before and uninitialized after RarManager | |||
#include "filesystem/SpecialProtocol.h" | |||
std::map<std::string, std::string> CSpecialProtocol::m_pathMap; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Seems like travis is still not happy. TestMassEvent.General and TestMultipleSharedSection.General still segfault (on clang3.5). Did any of you see them failing on your local machine? I've installed clang 3.5 now and still can't reproduce them. I executed the testsuite 100 times and it's been all stable for me :( |
I have seen em. they are extremely icky to track down, because they i know that
|
c935aaf
to
f445eb8
Compare
@notspiff: Thanks, I tried a few more things, but I couldn't reproduce a crash even one single time. "Luckily" the tests mentioned above fail in almost 100% of the Travis runs, so I've added a commit that prints the stacktrace. Since you know the codebase much better than me, can you read anything meaningful out of it? A test with clang-3.6 didn't help btw, the issue remains. https://travis-ci.org/xbmc/xbmc/builds/110214290:
I'll have a look also at your valgrind fixes. |
321c3a3
to
e7bac52
Compare
The destructor of RarManager uses CSpecialProtocol (a class with only statics). Therefore we have to make sure that CSpecialProtocol is destructed after RarManager. The C++ standard guarantees the order of con/destruction for statics only within the same compilation unit.
It's useful to have asserts enabled when running the test suites.
This prevents an occasionally occurring crash. Program terminated with signal SIGSEGV, Segmentation fault. 0 0x0000000003e21700 in ?? () Thread 2 (Thread 0x2ab2e881b940 (LWP 28679)): 0 0x00002ab2f156a330 in std::string::_Rep::_M_destroy(std::allocator<char> const&) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 1 0x0000000001079821 in CAdvancedSettings::~CAdvancedSettings() () 2 0x0000000001079ae9 in CAdvancedSettings::~CAdvancedSettings() () 3 0x00000000008b0f21 in xbmcutil::GlobalsSingleton<CAdvancedSettings>::Deleter<std::shared_ptr<CAdvancedSettings> >::~Deleter() () 4 0x00002ab2f1a06259 in __run_exit_handlers (status=0, listp=0x2ab2f1d886c8 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true) at exit.c:82 5 0x00002ab2f1a062a5 in __GI_exit (status=<optimized out>) at exit.c:104 6 0x00002ab2f19ebecc in __libc_start_main (main=0x855a50 <main>, argc=2, argv=0x7ffef5ebbcf8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffef5ebbce8) at libc-start.c:321 7 0x0000000000855984 in _start () Thread 1 (Thread 0x2ab3006d4700 (LWP 28684)): 0 0x0000000003e21700 in ?? () 1 0x0000000000e492a2 in XbmcCommons::ILogger::Log(int, char const*, ...) () 2 0x0000000000c507c2 in CThread::staticThread(void*) () 3 0x00002ab2e89cb182 in start_thread (arg=0x2ab3006d4700) at pthread_create.c:312 4 0x00002ab2f1ac447d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
e7bac52
to
9f6aa55
Compare
jenkins build this please |
[cmake] Fix tests (/ static initialization order)
This is an attempt to fix the unit tests when building with CMake.
79fe295 Fixes the static initialization order of CSpecialProtocol/RarManager:
The destructor of RarManager uses CSpecialProtocol (a class with only statics). Therefore we have to make sure that CSpecialProtocol is destructed after RarManager. According to the C++ standard, the order of con/destruction for statics is only guaranteed within the same compilation unit. Not a nice fix, I'm happy if anyone has a better idea.
Valgrind:
We've seen already a couple of problems with the global initialization order. With this fix, the test execute is stable now at least on my local machine. Still it's not 100% sure that there are not more problems.
@notspiff, @afedchin ping.