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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5201>
+#if defined (G_OS_UNIX) && !defined (__APPLE__)
static void
fault_restore (void)
{
static void
fault_restore (void)
{
sigaction (SIGSEGV, &action, NULL);
sigaction (SIGQUIT, &action, NULL);
}
sigaction (SIGSEGV, &action, NULL);
sigaction (SIGQUIT, &action, NULL);
}
+#endif /* G_OS_UNIX && !__APPLE__ */
void
gst_validate_spin_on_fault_signals (void)
{
void
gst_validate_spin_on_fault_signals (void)
{
+#if defined (G_OS_UNIX) && !defined (__APPLE__)
extern volatile gboolean glib_on_error_halt;
extern volatile gboolean glib_on_error_halt;
+#if defined (G_OS_UNIX) && !defined (__APPLE__)
static void fault_restore (void);
static void fault_spin (void);
#endif
static void fault_restore (void);
static void fault_spin (void);
#endif
/* convenience macro so we don't have to litter the code with if(!quiet) */
#define PRINT if(!quiet)gst_print
/* convenience macro so we don't have to litter the code with if(!quiet) */
#define PRINT if(!quiet)gst_print
+#if defined (G_OS_UNIX) && !defined (__APPLE__)
static void
fault_handler_sighandler (int signum)
{
static void
fault_handler_sighandler (int signum)
{
sigaction (SIGSEGV, &action, NULL);
sigaction (SIGQUIT, &action, NULL);
}
sigaction (SIGSEGV, &action, NULL);
sigaction (SIGQUIT, &action, NULL);
}
+#endif /* G_OS_UNIX && !__APPLE__ */
#if 0
typedef struct _GstIndexStats
#if 0
typedef struct _GstIndexStats
gst_tools_print_version ();
gst_tools_print_version ();
+#if defined (G_OS_UNIX) && !defined (__APPLE__)
if (!no_fault)
fault_setup ();
#endif
if (!no_fault)
fault_setup ();
#endif