All of lore.kernel.org
 help / color / mirror / Atom feed
* That xenstored console leak...
@ 2008-01-11 17:39 John Levon
  2008-01-11 19:24 ` Keir Fraser
  2008-01-11 19:48 ` Jim Fehlig
  0 siblings, 2 replies; 34+ messages in thread
From: John Levon @ 2008-01-11 17:39 UTC (permalink / raw)
  To: xen-devel


Here's what I'm using to fix it in 3.1. Obviously too risky for 3.2 now,
and anyway, there's a much more serious problem in 3.2 - entire /vm/
entries are leaked on domU reboot! I haven't got round to debugging that
one yet since it's not present in 3.1, but it really should be fixed

regards
john


# HG changeset patch
# User john.levon@sun.com
# Date 1200028523 28800
# Node ID 8a26f9a3f573a7c3b970f4349dd47fd4bf851df1
# Parent  c594cafb7e427e3b1f732a37c4b521f1e98dd08d
Cleanup xenstore after console device teardown

After the changes in 13616:b111908dd70b, DevController was leaking
xenstore entries every time we took down a console device, as there was
no equivalent to 'xenstore-rm -t' used in the hotplug scripts for "real"
devices. Implement the moral equivalent whenever removal is forced.

Signed-off-by: John Levon <john.levon@sun.com>

diff --git a/tools/python/xen/xend/server/DevController.py b/tools/python/xen/xend/server/DevController.py
--- a/tools/python/xen/xend/server/DevController.py
+++ b/tools/python/xen/xend/server/DevController.py
@@ -231,11 +231,21 @@ class DevController:
         self.writeBackend(dev, 'state', str(xenbusState['Closing']))
 
         if force:
-            frontpath = self.frontendPath(dev)
-            backpath = xstransact.Read(frontpath, "backend")
-            if backpath:
-                xstransact.Remove(backpath)
-            xstransact.Remove(frontpath)
+            try:
+                frontpath = self.frontendPath(dev)
+                t = xstransact()
+                backpath = t.read("%s/backend" % frontpath)
+                if backpath:
+                    t.remove(backpath)
+                    # tidy up empty directories
+                    while not t.list(backpath):
+                        t.remove(backpath)
+                        backpath = os.path.dirname(backpath)
+                t.remove(frontpath)
+                t.commit()
+            except:
+                t.abort()
+                raise
 
         self.vm._removeVm("device/%s/%d" % (self.deviceClass, dev))

^ permalink raw reply	[flat|nested] 34+ messages in thread
* Re: That xenstored console leak...
@ 2008-01-14 23:49 Jim Fehlig
  2008-01-15  8:10 ` Keir Fraser
  0 siblings, 1 reply; 34+ messages in thread
From: Jim Fehlig @ 2008-01-14 23:49 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel, Daniel P. Berrange, John Levon

[-- Attachment #1: Type: text/plain, Size: 1325 bytes --]

Keir Fraser wrote:
> On 14/1/08 20:08, "John Levon" <levon@movementarian.org> wrote:
>
>   
>> I see the behaviour in 3.1 with HVM domains. If I live migrate twice,
>> then the MAC address is lost, and a new random one is generated:
>>
>> I don't have to do anything "special", this happens every time on 3.1. I
>> presume that the troublesome changeset fixes this exact problem.
>>     
>
> Yes, device controllers clean up by deleting /vm/<uuid>/path/to/device. This
> aliases with the new domain's device information (because they're really the
> same vm) and so when the old domain is cleaned up the new domain loses
> information. Disambiguating with an extra level of indirection seemed the
> simplest fix for this. I'm not sure why this leads to xenstore leaks.
>
> When a domain is finally garbage collected in xend, perhaps we should delete
> its entire /vm/<uuid>/<unique-number>? That would seem a nice and reasonable
> catch-all.
>   

Reverting changesets 15967 and 15957 in addition to the attached patch
fixes the leak and allows multiple localhost migrations.  I'm not sure
what we get by nuking /vm/<uuid>/device/vif/<dev_num> anyway - other
than the problems we're seeing :-). vif appears to be the only device
stored in the /vm/<uuid>/device path anyway.

I will continue testing with this setup ...

Jim


[-- Attachment #2: xenstore-leak.diff --]
[-- Type: text/x-patch, Size: 580 bytes --]

diff -r 533a8e6cebd0 tools/python/xen/xend/server/DevController.py
--- a/tools/python/xen/xend/server/DevController.py	Sat Jan 12 11:26:04 2008 +0000
+++ b/tools/python/xen/xend/server/DevController.py	Mon Jan 14 16:38:18 2008 -0700
@@ -237,7 +237,6 @@ class DevController:
                 xstransact.Remove(backpath)
             xstransact.Remove(frontpath)
 
-        self.vm._removeVm("device/%s/%d" % (self.deviceClass, dev))
 
     def configurations(self, transaction = None):
         return map(lambda x: self.configuration(x, transaction), self.deviceIDs(transaction))

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 34+ messages in thread
* Re: That xenstored console leak...
@ 2008-01-18 23:14 Jim Fehlig
  2008-01-18 23:18 ` Keir Fraser
  0 siblings, 1 reply; 34+ messages in thread
From: Jim Fehlig @ 2008-01-18 23:14 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel, John Levon

Keir Fraser wrote:

>> Reverting changesets 15967 and 15957 in addition to the attached patch
>> fixes the leak and allows multiple localhost migrations.  I'm not sure
>> what we get by nuking /vm/<uuid>/device/vif/<dev_num> anyway - other
>> than the problems we're seeing :-). vif appears to be the only device
>> stored in the /vm/<uuid>/device path anyway.
>>
>> I will continue testing with this setup ...
>>     
>
> Isn't having two domains (even from the same vm) pointing at the same /vm/
> path a recipe for further bugs? Most of the lowlevel xend code doesn't seem
> to understand the concept that domains can map to the same vm, and could
> hence tread on each others toes via the /vm/ path.
>
> If we revert the two patches, what happens when you create/destroy lots of
> domains all with different uuids? I expect the leak will still exist in that
> case.
>   

Sorry for the delay.  I'm not sure why you think that the leak would
still exist with those changesets reverted.  15957 (and subsequently
15967) introduced the leak by creating a whole new /vm/<uuid>-<num>
path, leaving the previous path orphaned.  But I certainly don't claim
to be an expert on this code so perhaps I'm not understanding your concern.

Nevertheless, I created/destroyed lots of domains on 3.2 with those
changesets reverted and do not see the leak.  However I wouldn't expect
so since each domain has a different uuid and hence a different
/vm/<uuid> path, which is removed when the domain is destroyed.

BTW, with those changesets /vm/<uuid> path is leaked on save/restore,
reboot, and localhost migration.  Perhaps the source domain in these
operations should be removing its /vm path on destruction?

Jim

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2008-01-25 16:21 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-11 17:39 That xenstored console leak John Levon
2008-01-11 19:24 ` Keir Fraser
2008-01-11 19:48 ` Jim Fehlig
2008-01-11 19:57   ` John Levon
2008-01-14 19:27   ` Jim Fehlig
2008-01-14 20:08     ` John Levon
2008-01-14 21:29       ` Keir Fraser
2008-01-14 21:48         ` John Levon
2008-01-14 21:54           ` Keir Fraser
2008-01-14 22:55             ` John Levon
2008-01-14 22:59               ` Daniel P. Berrange
2008-01-15  8:08                 ` Keir Fraser
2008-01-15  8:06               ` Keir Fraser
2008-01-15 13:42                 ` John Levon
2008-01-15 13:54                   ` Keir Fraser
2008-01-15 13:57                   ` Keir Fraser
2008-01-15 13:59                     ` Keir Fraser
2008-01-15 14:31                       ` John Levon
2008-01-15 14:37                         ` Keir Fraser
2008-01-15 14:38                           ` John Levon
2008-01-15 14:42                             ` Keir Fraser
2008-01-15 15:59                               ` Jim Fehlig
2008-01-15 16:11                                 ` John Levon
2008-01-15 16:28                                   ` Keir Fraser
  -- strict thread matches above, loose matches on Subject: below --
2008-01-14 23:49 Jim Fehlig
2008-01-15  8:10 ` Keir Fraser
2008-01-18 23:14 Jim Fehlig
2008-01-18 23:18 ` Keir Fraser
2008-01-18 23:47   ` Jim Fehlig
2008-01-19  8:11     ` Keir Fraser
2008-01-25  2:00       ` Jim Fehlig
2008-01-25  7:44         ` Keir Fraser
     [not found]           ` <479A002E.6010802@novell.com>
2008-01-25 15:41             ` John Levon
2008-01-25 16:21               ` Jim Fehlig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.