From 4d172a20154500bd4b67f1a91c806e5554f2cf05 Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Mon, 12 Dec 2022 12:39:25 -0600 Subject: [PATCH 1/2] Revert "gthread: Only print scheduler setting warnings once" This reverts commit c8840ff9a8f8445e81ded935bb6637857089a99f. --- glib/gthread-posix.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/glib/gthread-posix.c b/glib/gthread-posix.c index d96fca5ca..da90d46ee 100644 --- a/glib/gthread-posix.c +++ b/glib/gthread-posix.c @@ -1248,7 +1248,6 @@ static void * linux_pthread_proxy (void *data) { GThreadPosix *thread = data; - static gboolean printed_scheduler_warning = FALSE; /* (atomic) */ /* Set scheduler settings first if requested */ if (thread->scheduler_settings) @@ -1261,10 +1260,8 @@ linux_pthread_proxy (void *data) tid = (pid_t) syscall (SYS_gettid); res = syscall (SYS_sched_setattr, tid, thread->scheduler_settings->attr, flags); errsv = errno; - if (res == -1 && g_atomic_int_compare_and_exchange (&printed_scheduler_warning, FALSE, TRUE)) + if (res == -1) g_critical ("Failed to set scheduler settings: %s", g_strerror (errsv)); - else if (res == -1) - g_debug ("Failed to set scheduler settings: %s", g_strerror (errsv)); } return thread->proxy (data); From d900d0efce39c889d094ebb1248402bb5071dbf3 Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Mon, 12 Dec 2022 12:39:46 -0600 Subject: [PATCH 2/2] Revert "GThread: Don't g_error() if setting the thread scheduler settings fails" This reverts commit 965061797d74847d2e2d1237bb7a63328608e28c. We are having trouble tracking down the cause of #2769. When the bug occurs, we fail to set scheduler settings for the new thread pool thread. This can have serious consequences and should not be ignored. In retrospect, making this a critical instead of a fatal error has made it more difficult to notice, debug, and fix. This operation needs to always work, so let's crash when it fails. This does not fix #2769, but will hopefully help. --- glib/gthread-posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/gthread-posix.c b/glib/gthread-posix.c index da90d46ee..49ac28cb1 100644 --- a/glib/gthread-posix.c +++ b/glib/gthread-posix.c @@ -1261,7 +1261,7 @@ linux_pthread_proxy (void *data) res = syscall (SYS_sched_setattr, tid, thread->scheduler_settings->attr, flags); errsv = errno; if (res == -1) - g_critical ("Failed to set scheduler settings: %s", g_strerror (errsv)); + g_error ("Failed to set scheduler settings: %s", g_strerror (errsv)); } return thread->proxy (data);