[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1051576: marked as done (bookworm-pu: package gjs/1.74.2-1+deb12u1)



Your message dated Sat, 07 Oct 2023 09:59:42 +0000
with message-id <E1qp462-00A4GO-0U@coccia.debian.org>
and subject line Released with 12.2
has caused the Debian Bug report #1051576,
regarding bookworm-pu: package gjs/1.74.2-1+deb12u1
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
1051576: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1051576
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: release.debian.org
Severity: normal
Tags: bookworm
User: release.debian.org@packages.debian.org
Usertags: pu
X-Debbugs-Cc: gjs@packages.debian.org
Control: affects -1 + src:gjs

[ Reason ]
#1034356

[ Impact ]
If there is a particular category of programming error (something
not disconnecting all of its signal/idle/timeout handlers when it
should, for example #1049947 which seems most likely to be a bug in
gnome-shell-extension-vertical-overview) then the failure mode is an
infinite loop of assertion messages/stack traces, flooding the log and
(in the case of GNOME Shell) freezing the UI. With the change proposed
in this update, it should instead log O(1) assertion messages and stack
traces, then continue normally, avoiding the infinite loop.

[ Tests ]
A prerelease (equivalent except for the changelog and version number) is
available in https://people.debian.org/~smcv/12.2/pool/main/g/gjs/, and I
have been using it for a couple of weeks on two bookworm GNOME machines
(a gaming desktop and my partner's laptop) with no obvious regressions.

The submitter of #1034356/#1049947 has been testing the same prerelease
for 2 weeks, but they do not know how to reproduce the bug on-demand,
so it is not immediately clear whether it has been fixed. I sent a
reminder today asking them to report their test results.

The same change has been in unstable since 17 August with no obvious
regressions, and should be released in upstream 1.78.0 soon.

[ Risks ]
I would say this is low risk: it's a targeted fix backported from
upstream, changing the order of some operations so that on a programming
error, callbacks reliably return a zero-filled value (usually 0 or NULL)
instead of whatever happens to be in uninitialized memory.

[ Checklist ]
  [x] *all* changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in (old)stable
  [x] the issue is verified as fixed in unstable

[ Changes ]
All changes are for #1034356.
diffstat for gjs-1.74.2 gjs-1.74.2

 debian/changelog                                                      |   12 +
 debian/patches/function-Always-initialize-callback-return-value.patch |   66 ++++++++++
 debian/patches/series                                                 |    1 
 gi/function.cpp                                                       |   18 +-
 4 files changed, 87 insertions(+), 10 deletions(-)

diff -Nru gjs-1.74.2/debian/changelog gjs-1.74.2/debian/changelog
--- gjs-1.74.2/debian/changelog	2023-02-21 12:13:29.000000000 +0000
+++ gjs-1.74.2/debian/changelog	2023-09-09 20:29:21.000000000 +0100
@@ -1,3 +1,15 @@
+gjs (1.74.2-1+deb12u1) bookworm; urgency=medium
+
+  * d/p/function-Always-initialize-callback-return-value.patch:
+    Add patch backported from upstream 1.77.1 avoiding infinite loops
+    of idle callbacks if an idle handler is called during GC. The most
+    common reason for this is if a GNOME Shell extension incorrectly does
+    not disconnect all of its signal/idle/timeout handlers. This change
+    mitigates the infinite loop and associated log flooding, but does not
+    fix the extension behaviour. (Closes: #1034356)
+
+ -- Simon McVittie <smcv@debian.org>  Sat, 09 Sep 2023 20:29:21 +0100
+
 gjs (1.74.2-1) unstable; urgency=medium
 
   * New upstream release
diff -Nru gjs-1.74.2/debian/patches/function-Always-initialize-callback-return-value.patch gjs-1.74.2/debian/patches/function-Always-initialize-callback-return-value.patch
--- gjs-1.74.2/debian/patches/function-Always-initialize-callback-return-value.patch	1970-01-01 01:00:00.000000000 +0100
+++ gjs-1.74.2/debian/patches/function-Always-initialize-callback-return-value.patch	2023-09-09 20:29:21.000000000 +0100
@@ -0,0 +1,66 @@
+From: Sebastian Keller <skeller@gnome.org>
+Date: Thu, 16 Mar 2023 22:35:49 +0100
+Subject: function: Always initialize callback return value
+
+When callback_closure() exits early, for example due to being called
+during GC, the return value would not be initialized. This value is
+often non-zero. If the callback is a source func of an idle or a timeout
+this would then get interpreted as G_SOURCE_CONTINUE and the same would
+repeat in the next iteration. If this happens fast enough, this results
+in the entire process being seemingly frozen while spamming the log with
+error messages.
+
+To fix this always initialize the return value to 0 or a comparable
+neutral value.
+
+Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/1868
+Bug-Debian: https://bugs.debian.org/1034356
+Forwarded: https://gitlab.gnome.org/GNOME/gjs/-/merge_requests/832
+Applied-upstream: 1.77.1, commit:c925d91e5d018f38b0f66d0ac592274d4b007efb
+---
+ gi/function.cpp | 18 ++++++++----------
+ 1 file changed, 8 insertions(+), 10 deletions(-)
+
+diff --git a/gi/function.cpp b/gi/function.cpp
+index 08a0ea2..2fe4b2c 100644
+--- a/gi/function.cpp
++++ b/gi/function.cpp
+@@ -287,6 +287,14 @@ void GjsCallbackTrampoline::warn_about_illegal_js_callback(const char* when,
+ void GjsCallbackTrampoline::callback_closure(GIArgument** args, void* result) {
+     GITypeInfo ret_type;
+ 
++    // Fill in the result with some hopefully neutral value
++    g_callable_info_load_return_type(m_info, &ret_type);
++    if (g_type_info_get_tag(&ret_type) != GI_TYPE_TAG_VOID) {
++        GIArgument argument = {};
++        gjs_gi_argument_init_default(&ret_type, &argument);
++        set_return_ffi_arg_from_giargument(&ret_type, result, &argument);
++    }
++
+     if (G_UNLIKELY(!is_valid())) {
+         warn_about_illegal_js_callback(
+             "during shutdown",
+@@ -362,8 +370,6 @@ void GjsCallbackTrampoline::callback_closure(GIArgument** args, void* result) {
+ 
+     JS::RootedValue rval(context);
+ 
+-    g_callable_info_load_return_type(m_info, &ret_type);
+-
+     if (!callback_closure_inner(context, this_object, &rval, args, &ret_type,
+                                 n_args, c_args_offset, result)) {
+         if (!JS_IsExceptionPending(context)) {
+@@ -384,14 +390,6 @@ void GjsCallbackTrampoline::callback_closure(GIArgument** args, void* result) {
+                     m_info.ns(), m_info.name());
+         }
+ 
+-        // Fill in the result with some hopefully neutral value
+-        if (g_type_info_get_tag(&ret_type) != GI_TYPE_TAG_VOID) {
+-            GIArgument argument = {};
+-            g_callable_info_load_return_type(m_info, &ret_type);
+-            gjs_gi_argument_init_default(&ret_type, &argument);
+-            set_return_ffi_arg_from_giargument(&ret_type, result, &argument);
+-        }
+-
+         // If the callback has a GError** argument, then make a GError from the
+         // value that was thrown. Otherwise, log it as "uncaught" (critical
+         // instead of warning)
diff -Nru gjs-1.74.2/debian/patches/series gjs-1.74.2/debian/patches/series
--- gjs-1.74.2/debian/patches/series	2023-02-21 12:13:29.000000000 +0000
+++ gjs-1.74.2/debian/patches/series	2023-09-09 20:29:21.000000000 +0100
@@ -0,0 +1 @@
+function-Always-initialize-callback-return-value.patch
diff -Nru gjs-1.74.2/gi/function.cpp gjs-1.74.2/gi/function.cpp
--- gjs-1.74.2/gi/function.cpp	2023-02-21 07:17:47.000000000 +0000
+++ gjs-1.74.2/gi/function.cpp	2023-09-09 20:47:53.000000000 +0100
@@ -287,6 +287,14 @@
 void GjsCallbackTrampoline::callback_closure(GIArgument** args, void* result) {
     GITypeInfo ret_type;
 
+    // Fill in the result with some hopefully neutral value
+    g_callable_info_load_return_type(m_info, &ret_type);
+    if (g_type_info_get_tag(&ret_type) != GI_TYPE_TAG_VOID) {
+        GIArgument argument = {};
+        gjs_gi_argument_init_default(&ret_type, &argument);
+        set_return_ffi_arg_from_giargument(&ret_type, result, &argument);
+    }
+
     if (G_UNLIKELY(!is_valid())) {
         warn_about_illegal_js_callback(
             "during shutdown",
@@ -362,8 +370,6 @@
 
     JS::RootedValue rval(context);
 
-    g_callable_info_load_return_type(m_info, &ret_type);
-
     if (!callback_closure_inner(context, this_object, &rval, args, &ret_type,
                                 n_args, c_args_offset, result)) {
         if (!JS_IsExceptionPending(context)) {
@@ -384,14 +390,6 @@
                     m_info.ns(), m_info.name());
         }
 
-        // Fill in the result with some hopefully neutral value
-        if (g_type_info_get_tag(&ret_type) != GI_TYPE_TAG_VOID) {
-            GIArgument argument = {};
-            g_callable_info_load_return_type(m_info, &ret_type);
-            gjs_gi_argument_init_default(&ret_type, &argument);
-            set_return_ffi_arg_from_giargument(&ret_type, result, &argument);
-        }
-
         // If the callback has a GError** argument, then make a GError from the
         // value that was thrown. Otherwise, log it as "uncaught" (critical
         // instead of warning)

--- End Message ---
--- Begin Message ---
Version: 12.2

The upload requested in this bug has been released as part of 12.2.

--- End Message ---

Reply to: