[gnome-software/gnome-40: 1/2] flatpak: Deadlock after changes from the command line




commit 0cb74589da45af55883366eeeb67c247fc5145da
Author: Milan Crha <mcrha redhat com>
Date:   Fri May 7 07:58:42 2021 +0200

    flatpak: Deadlock after changes from the command line
    
    The 'broken_remotes' mutex had been held for too long, causing a deadlock.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1247

 plugins/flatpak/gs-flatpak.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 1dcb8904a..faf245ca6 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -1183,6 +1183,8 @@ gs_flatpak_refresh_appstream (GsFlatpak *self, guint cache_age,
                        continue;
                }
 
+               g_clear_pointer (&locker, g_mutex_locker_free);
+
                /* is the timestamp new enough */
                file_timestamp = flatpak_remote_get_appstream_timestamp (xremote, NULL);
                tmp = gs_utils_get_file_age (file_timestamp);
@@ -1207,6 +1209,9 @@ gs_flatpak_refresh_appstream (GsFlatpak *self, guint cache_age,
                                             GS_PLUGIN_ERROR_FAILED)) {
                                g_debug ("Failed to get AppStream metadata: %s",
                                         error_local->message);
+
+                               locker = g_mutex_locker_new (&self->broken_remotes_mutex);
+
                                /* don't try to fetch this again until refresh() */
                                g_hash_table_insert (self->broken_remotes,
                                                     g_strdup (remote_name),


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