From c2c2bc2ec2cbb306057bb87f59aa3a7c3ebed623 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Piotr=20Brzezi=C5=84ski?= Date: Tue, 15 Aug 2023 16:01:28 +0200 Subject: [PATCH] tools: Disable fault signal handlers in gst-launch/gst-validate on macOS By default, macOS attempts to run lldb against a misbehaving process to handle the crash. This does not play well with the SISEGV/SIGQUIT handler we add in gst-launch/gst-validate. The 'spinning' mechanism causes the lldb and debugserver processes ran by macOS to misbehave, taking 100% CPU and rendering both themselves and the GStreamer instance frozen and very hard to effectively kill. macOS's Activity Monitor is also unusable while this is happening. This patch takes the quickest possible solution of just disabling those signal handlers entirely on macOS. Part-of: --- .../gst-devtools/validate/gst/validate/gst-validate-utils.c | 6 +++--- subprojects/gstreamer/tools/gst-launch.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/subprojects/gst-devtools/validate/gst/validate/gst-validate-utils.c b/subprojects/gst-devtools/validate/gst/validate/gst-validate-utils.c index b6a3173..e791f05 100644 --- a/subprojects/gst-devtools/validate/gst/validate/gst-validate-utils.c +++ b/subprojects/gst-devtools/validate/gst/validate/gst-validate-utils.c @@ -1095,7 +1095,7 @@ gst_validate_object_set_property (GstValidateReporter * reporter, return res; } -#ifdef G_OS_UNIX +#if defined (G_OS_UNIX) && !defined (__APPLE__) static void fault_restore (void) { @@ -1158,12 +1158,12 @@ fault_setup (void) sigaction (SIGSEGV, &action, NULL); sigaction (SIGQUIT, &action, NULL); } -#endif /* G_OS_UNIX */ +#endif /* G_OS_UNIX && !__APPLE__ */ void gst_validate_spin_on_fault_signals (void) { -#ifdef G_OS_UNIX +#if defined (G_OS_UNIX) && !defined (__APPLE__) fault_setup (); #endif } diff --git a/subprojects/gstreamer/tools/gst-launch.c b/subprojects/gstreamer/tools/gst-launch.c index efc76fd..fafde85 100644 --- a/subprojects/gstreamer/tools/gst-launch.c +++ b/subprojects/gstreamer/tools/gst-launch.c @@ -56,7 +56,7 @@ extern volatile gboolean glib_on_error_halt; -#ifdef G_OS_UNIX +#if defined (G_OS_UNIX) && !defined (__APPLE__) static void fault_restore (void); static void fault_spin (void); #endif @@ -95,7 +95,7 @@ static gboolean waiting_eos = FALSE; /* convenience macro so we don't have to litter the code with if(!quiet) */ #define PRINT if(!quiet)gst_print -#ifdef G_OS_UNIX +#if defined (G_OS_UNIX) && !defined (__APPLE__) static void fault_handler_sighandler (int signum) { @@ -161,7 +161,7 @@ fault_setup (void) sigaction (SIGSEGV, &action, NULL); sigaction (SIGQUIT, &action, NULL); } -#endif /* G_OS_UNIX */ +#endif /* G_OS_UNIX && !__APPLE__ */ #if 0 typedef struct _GstIndexStats @@ -1184,7 +1184,7 @@ real_main (int argc, char *argv[]) gst_tools_print_version (); -#ifdef G_OS_UNIX +#if defined (G_OS_UNIX) && !defined (__APPLE__) if (!no_fault) fault_setup (); #endif -- 2.7.4