[gnome-software/1247-flatpak-deadlock-after-changes-from-the-command-line] flatpak: Deadlock after changes from the command line



commit ec3586c4c5d079657b72a168c7bac3d72bd81e39
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]