source spoke race (?) bug

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

 



I've been trying to track down a problem with the source spoke.  It
appears to be a race condition given that I can't reproduce it every
single time.  But the steps to reproduce are pretty easy:

(1) Go into the source spoke.
(2) Change the source to something obviously wrong, like http://blah
(3) Wait on the hub.

You'll probably see the spoke selector insensitive with the error mesage
"Error setting up software source".  However, it can still be clicked on
and then the UI will just be all screwed up.

Looked like a race condition to me, especially once I started poking
around with it.  In spokes/source.py:getRepoMetadata (which is run from
a thread), it does a send_ready at the end.  send_ready will cause the
spoke's ready property to be referenced, which in this case checks if
the same thread is still running.  So as you can see, the potential for
a race exists.

I've been experimenting with the attached patch, but I'm not getting
anywhere.  It seems to get rid of the potential for a race, but the
spoke is still insensitive.

I don't suppose anyone has any clever ideas?

- Chris

diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py
index f570700..3c6dc59 100644
--- a/pyanaconda/ui/gui/spokes/source.py
+++ b/pyanaconda/ui/gui/spokes/source.py
@@ -509,6 +509,7 @@ class SourceSpoke(NormalSpoke):
 
         threadMgr.add(AnacondaThread(name="AnaPayloadMDThread",
                                      target=self.getRepoMetadata))
+        GLib.timeout_add_seconds(1, self._send_ready_when_done)
         self.window.clear_info()
 
     def getRepoMetadata(self):
@@ -533,7 +534,6 @@ class SourceSpoke(NormalSpoke):
                 self.window.set_info(Gtk.MessageType.WARNING, _("Failed to set up install source, check the repo url"))
             else:
                 self.window.set_info(Gtk.MessageType.WARNING, _("Failed to set up install source, check the repo url and proxy settings"))
-            communication.send_ready(self.__class__.__name__)
         else:
             self._error = False
             communication.send_message(self.__class__.__name__,
@@ -543,13 +543,18 @@ class SourceSpoke(NormalSpoke):
             if not self.payload.baseRepo:
                 communication.send_message(self.__class__.__name__,
                                            _(METADATA_ERROR_MESSAGE))
-                communication.send_ready(self.__class__.__name__)
                 self._error = True
                 self.window.set_info(Gtk.MessageType.WARNING, _("Failed to set up install source, check the repo url"))
             else:
-                communication.send_ready(self.__class__.__name__)
                 communication.send_ready("SoftwareSelectionSpoke")
 
+    def _send_ready_when_done(self):
+        if self.ready:
+            communication.send_ready(self.__class__.__name__)
+            return False
+        else:
+            return True
+
     @property
     def completed(self):
         return not self._error and self.status and self.status != _("Nothing selected")

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux