WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Ignore any watches that fire for which we do not have a

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Ignore any watches that fire for which we do not have a registration. This can
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 12 Oct 2005 12:32:12 +0000
Delivery-date: Wed, 12 Oct 2005 12:29:50 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User emellor@ewan
# Node ID 00a324b3a2db17545065176a7acf83f45e259ab3
# Parent  09447f91ab4918d40b6a2357b1b8665ffa4726e6
Ignore any watches that fire for which we do not have a registration.  This can
happen if there are watches in flight at the same time as a deregistration, and
also seems to happen spuriously on xend restart.

This fixes the Invalid token error that has been seen on xend restart.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r 09447f91ab49 -r 00a324b3a2db tools/python/xen/lowlevel/xs/xs.c
--- a/tools/python/xen/lowlevel/xs/xs.c Wed Oct 12 11:56:52 2005
+++ b/tools/python/xen/lowlevel/xs/xs.c Wed Oct 12 12:00:55 2005
@@ -513,6 +513,7 @@
         goto exit;
     if (!PyArg_ParseTupleAndKeywords(args, kwds, arg_spec, kwd_spec))
         goto exit;
+again:
     Py_BEGIN_ALLOW_THREADS
     xsval = xs_read_watch(xh, &num);
     Py_END_ALLOW_THREADS
@@ -529,8 +530,13 @@
             break;
     }
     if (i == PyList_Size(xsh->watches)) {
-        PyErr_SetString(PyExc_RuntimeError, "invalid token");
-        goto exit;
+      /* We do not have a registered watch for the one that has just fired.
+         Ignore this -- a watch that has been recently deregistered can still
+         have watches in transit.  This is a blocking method, so go back to
+         read again.
+      */
+      free(xsval);
+      goto again;
     }
     /* Create tuple (path, token). */
     val = Py_BuildValue("(sO)", xsval[XS_WATCH_PATH], token);
diff -r 09447f91ab49 -r 00a324b3a2db tools/python/xen/xend/xenstore/xswatch.py
--- a/tools/python/xen/xend/xenstore/xswatch.py Wed Oct 12 11:56:52 2005
+++ b/tools/python/xen/xend/xenstore/xswatch.py Wed Oct 12 12:00:55 2005
@@ -9,6 +9,9 @@
 import threading
 from xen.lowlevel import xs
 from xen.xend.xenstore.xsutil import xshandle
+
+from xen.xend.XendLogging import log
+
 
 class xswatch:
 
@@ -41,10 +44,13 @@
         while True:
             try:
                 we = cls.xs.read_watch()
-            except RuntimeError, ex:
-                print ex
-                raise
-            watch = we[1]
-            watch.fn(*watch.args, **watch.kwargs)
+                watch = we[1]
+                watch.fn(*watch.args, **watch.kwargs)
+            except:
+                log.exception("read_watch failed")
+                # Ignore this exception -- there's no point throwing it
+                # further on because that will just kill the watcher thread,
+                # which achieves nothing.
+
 
     watchMain = classmethod(watchMain)

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Ignore any watches that fire for which we do not have a registration. This can, Xen patchbot -unstable <=