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

Re: [Xen-devel] XenStore Watch Behavior


  • To: John McCullough <jmccullo@xxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
  • Date: Tue, 29 Aug 2006 07:27:09 +0100
  • Delivery-date: Mon, 28 Aug 2006 23:36:32 -0700
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: AcbLNCedZlNZ+jcnEduf9QANk04WTA==
  • Thread-topic: [Xen-devel] XenStore Watch Behavior

On 29/8/06 3:22 am, "John McCullough" <jmccullo@xxxxxxxxxxx> wrote:

> Recently I discovered that my watch and the xswatch were receiving
> alternating watches (both in python).  Looking at xs_read_watch in
> tools/xenstore/xs.c, the mutex on the xshandle forces all xs_read_watch
> calls to take turns.  Given that the python interface shares a single
> xshandle, this prevents multiple watches.
> 
> Creating an entirely new xshandle for each use of read_watch works.
> Moving to a model where the xsutil.xshandle() call creates a new
> xshandle seems easily supportable, given that xswatch is primarily used,
> and it keeps a reference to it's own handle.
> 
> Does anyone know of other xshandle() uses that warrant the current
> behavior?

The current behaviour is broken (or, at least, the semantics really make no
sense at all) if multiple people create 'xs' objects in the same python
program. A good fix would be to move the handle allocation from
xshandle_init to xshandle_new. The latter function will have to create a new
container object to hold the handle value, rather than returning self.
Watches will then be registered and read in the isolated context of a
particular caller's object handle, rather than a bogus shared global context
of all users of the xs library.

This fix should then get things working for your code if you create yourself
an xs object separate from xswatch's. It only raises the question how you
then implement a central select loop in your python program that waits on
the various file handles or sockets created by the various xs objects.

 -- Keir



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.