After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 665198 - Fix removal of libvirt machines
Fix removal of libvirt machines
Status: RESOLVED FIXED
Product: gnome-boxes
Classification: Applications
Component: general
unspecified
Other All
: Normal normal
: --
Assigned To: GNOME Boxes maintainer(s)
GNOME Boxes maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2011-11-30 13:46 UTC by Zeeshan Ali
Modified: 2016-03-31 14:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix removal of libvirt machines (2.74 KB, patch)
2011-11-30 13:46 UTC, Zeeshan Ali
reviewed Details | Review
Fix removal of libvirt machines (2.15 KB, patch)
2011-11-30 15:30 UTC, Zeeshan Ali
needs-work Details | Review
Fix removal of libvirt machines (4.60 KB, patch)
2011-12-05 17:41 UTC, Zeeshan Ali
reviewed Details | Review

Description Zeeshan Ali 2011-11-30 13:46:16 UTC
Because of cyclic and leaked references, libvirt machines weren't
actually getting entirely removed. As a result boxes kept asking the
inexistent domains for stats every second and ended-up flooding the
console with warnings.
Comment 1 Zeeshan Ali 2011-11-30 13:46:18 UTC
Created attachment 202443 [details] [review]
Fix removal of libvirt machines

Because of cyclic and leaked references, libvirt machines weren't
actually getting entirely removed. As a result boxes kept asking the
inexistent domains for stats every second and ended-up flooding the
console with warnings.
Comment 2 Marc-Andre Lureau 2011-11-30 14:44:10 UTC
Review of attachment 202443 [details] [review]:

::: src/app.vala
@@ +97,3 @@
         connection.domain_removed.connect ((connection, domain) => {
+            var machine = domain.get_data<unowned LibvirtMachine> ("machine");
+            machine.set_stats_enable (false);

if the leaks were gone, I suppose this wouldn't be necessary

perhaps you can just make a patch with this set_stats_enable (false); add a FIXME:  refcount object not destroyed or something. I am not sure about the rest of the changes now,
Comment 3 Zeeshan Ali 2011-11-30 15:30:32 UTC
Created attachment 202450 [details] [review]
Fix removal of libvirt machines

Because of cyclic and leaked references, libvirt machines weren't
actually getting entirely removed. As a result boxes kept asking the
inexistent domains for stats every second and ended-up flooding the
console with warnings.
Comment 4 Marc-Andre Lureau 2011-11-30 15:57:19 UTC
Review of attachment 202450 [details] [review]:

::: src/app.vala
@@ +97,3 @@
         connection.domain_removed.connect ((connection, domain) => {
             var machine = domain.get_data<LibvirtMachine> ("machine");
+            machine.set_stats_enable (false);

same remark, if the leaks were gone, this wouldn't be needed.
Comment 5 Zeeshan Ali 2011-11-30 16:00:16 UTC
(In reply to comment #4)
> Review of attachment 202450 [details] [review]:
> 
> ::: src/app.vala
> @@ +97,3 @@
>          connection.domain_removed.connect ((connection, domain) => {
>              var machine = domain.get_data<LibvirtMachine> ("machine");
> +            machine.set_stats_enable (false);
> 
> same remark, if the leaks were gone, this wouldn't be needed.

This is needed to get rid of the ref that a previous machine.set_stats_enable (true) call from within LibvirtMachine constructor creates. Thats why I left 'cyclic ref' in the commit log.
Comment 6 Zeeshan Ali 2011-12-05 17:41:42 UTC
Created attachment 202852 [details] [review]
Fix removal of libvirt machines

Because of some leaked references, libvirt machines and associated
periodic updates weren't actually getting removed. Boxes kept asking
inexistent domains for stats every second and ended-up flooding the
console with warnings.
Comment 7 Marc-Andre Lureau 2011-12-05 17:53:15 UTC
Review of attachment 202852 [details] [review]:

2 comments, otherwise ack

::: src/libvirt-machine.vala
@@ +330,3 @@
         }
 
         set_stats_enable (false);

can you also make set_stats_enable private?

::: src/remote-machine.vala
@@ +84,3 @@
 
+    public override void delete (bool by_user = true) {
+        assert (by_user);

I prefer return_if_fail() which at least doesn't abort your program and let's you finish whatever you did before.
Comment 8 Zeeshan Ali 2011-12-05 17:58:56 UTC
Attachment 202852 [details] pushed as ae088cb - Fix removal of libvirt machines