bridge: workaround valgrind issue
Add some code to cockpit-bridge to detect if it's running under valgrind (ie: as part of 'make check-memory') and cause it to delay its exit by 5 seconds in that case. This helps avoid https://bugs.kde.org/show_bug.cgi?id=409367, which otherwise will cause the units test container to hang fairly regularly on Ubuntu 19.04. Closes #12255
This commit is contained in:
parent
78361bf95c
commit
5716079402
|
@ -610,6 +610,18 @@ run_bridge (const gchar *interactive,
|
|||
g_source_remove (sig_term);
|
||||
g_source_remove (sig_int);
|
||||
|
||||
/* HACK: Valgrind contains a bug that causes it to hang when the main
|
||||
* thread exits quickly in response to a signal received by a handler
|
||||
* in another thread, when that other thread is waiting in a syscall.
|
||||
* Avoid that situation by delaying our exit here, but only under
|
||||
* Valgrind.
|
||||
*
|
||||
* Remove this when https://bugs.kde.org/show_bug.cgi?id=409367 is
|
||||
* fixed and widely distributed.
|
||||
*/
|
||||
if (strstr (g_getenv ("LD_PRELOAD") ?: "", "valgrind") != NULL)
|
||||
g_usleep (5 * G_TIME_SPAN_SECOND);
|
||||
|
||||
/* So the caller gets the right signal */
|
||||
if (terminated)
|
||||
raise (SIGTERM);
|
||||
|
|
Loading…
Reference in New Issue