public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/chatty] rawhide: Add patch to fix 'history' test failure on s390x
@ 2026-06-26 13:45 Milan Crha
  0 siblings, 0 replies; only message in thread
From: Milan Crha @ 2026-06-26 13:45 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/chatty
Branch : rawhide
Commit : 09500cdde3ac2dc5bb949bf7a70328db2169cd56
Author : Milan Crha <mcrha@redhat.com>
Date   : 2026-06-26T15:39:52+02:00
Stats  : +84/-0 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/chatty/c/09500cdde3ac2dc5bb949bf7a70328db2169cd56?branch=rawhide

Log:
Add patch to fix 'history' test failure on s390x

---
diff --git a/0002-fix-history-test.patch b/0002-fix-history-test.patch
new file mode 100644
index 0000000..a846eaa
--- /dev/null
+++ b/0002-fix-history-test.patch
@@ -0,0 +1,81 @@
+From 2f3cd4bd8b60aecaedaaa62db0167a6ceb5bf8f6 Mon Sep 17 00:00:00 2001
+Date: Fri, 26 Jun 2026 15:07:48 +0200
+Subject: [PATCH] history: Make sure after successful close of DB the worker
+ thread is stopped
+
+Close of the DB means the worker thread is not available, but instead
+of just unreffing it rather wait for it in the main thread and only then
+finish the close DB operation.
+
+The history test can fail with too many refs on the history object
+on slower arches, or even when just adding a delay after calling the callback
+in the worker thread, which slows down the worker thread closing
+and the inner GTask (which holds a reference on the history object)
+as well.
+
+Wait on the g_thread_join() in the main thread is instant, because the worker
+thread closes itself usually before the main loop gets to the scheduled
+idle callback.
+
+https://gitlab.gnome.org/World/Chatty/-/merge_requests/1493
+---
+ src/chatty-history.c | 34 +++++++++++++++++++++++++++++++---
+ 1 file changed, 31 insertions(+), 3 deletions(-)
+
+diff --git a/src/chatty-history.c b/src/chatty-history.c
+index 0f23a9a7..59f37033 100644
+--- a/src/chatty-history.c
++++ b/src/chatty-history.c
+@@ -1988,6 +1988,29 @@ history_open_db (ChattyHistory *self,
+   }
+ }
+ 
++typedef struct {
++  GThread *worker_thread;
++  GTask   *task;
++} CloseDbData;
++
++static gboolean
++history_close_db_complete (gpointer user_data)
++{
++  CloseDbData *data = user_data;
++
++  if (data->worker_thread)
++    {
++      g_thread_join (data->worker_thread);
++      data->worker_thread = NULL;
++    }
++
++  g_task_return_boolean (data->task, TRUE);
++  g_object_unref (data->task);
++  g_free (data);
++
++  return G_SOURCE_REMOVE;
++}
++
+ static void
+ history_close_db (ChattyHistory *self,
+                   GTask         *task)
+@@ -2013,11 +2036,16 @@ history_close_db (ChattyHistory *self,
+      * actions with the same @self will not execute, and so the tasks
+      * will take ∞ time to complete.
+      *
+-     * Hence invalidate the @self's ref to this task:
++     * Hence invalidate the @self's ref to this task and wait
++     * in the main thread for the worker thread to finish:
+      */
+-    g_clear_pointer (&self->worker_thread, g_thread_unref);
++    CloseDbData *data = g_new0 (CloseDbData, 1);
++
++    data->worker_thread = g_steal_pointer (&self->worker_thread);
++    data->task = g_object_ref (task);
++
+     g_debug ("Database closed successfully");
+-    g_task_return_boolean (task, TRUE);
++    g_idle_add (history_close_db_complete, data);
+   } else {
+     g_task_return_new_error (task,
+                              G_IO_ERROR,
+-- 
+GitLab
+

diff --git a/chatty.spec b/chatty.spec
index 1c275ae..831a864 100644
--- a/chatty.spec
+++ b/chatty.spec
@@ -21,6 +21,9 @@ Patch0:  0001-hacky-hack.patch
 # https://source.puri.sm/Librem5/libcmatrix/-/merge_requests/116
 Patch1:  116.patch
 
+# https://gitlab.gnome.org/World/Chatty/-/merge_requests/1493
+Patch2: 0002-fix-history-test.patch
+
 ExcludeArch:    %{ix86}
 
 BuildRequires:  gcc

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-26 13:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-26 13:45 [rpms/chatty] rawhide: Add patch to fix 'history' test failure on s390x Milan Crha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox