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-tools

[Xen-tools] Re: xenstored crash

To: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
Subject: [Xen-tools] Re: xenstored crash
From: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>
Date: Wed, 14 Sep 2005 09:42:56 +0100
Cc: Xen Tools <xen-tools@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 14 Sep 2005 08:41:27 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1126674587.7896.42.camel@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-tools-request@lists.xensource.com?subject=help>
List-id: Xen control tools developers <xen-tools.lists.xensource.com>
List-post: <mailto:xen-tools@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-tools>, <mailto:xen-tools-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-tools>, <mailto:xen-tools-request@lists.xensource.com?subject=unsubscribe>
References: <20050913211251.GZ3380@xxxxxxxxxxxx> <1126674587.7896.42.camel@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-tools-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.1i
On Wed, Sep 14, 2005 at 03:09:47PM +1000, Rusty Russell wrote:
> On Tue, 2005-09-13 at 22:12 +0100, Christian Limpach wrote:
> > Rusty,
> > 
> > could you take a look at the following crash:
> > (gdb) run -N --pid-file=/var/run/xenstore.pid -T 
> > /var/log/xenstored-trace.log
> > Starting program: /usr/sbin/xenstored -N --pid-file=/var/run/xenstore.pid 
> > -T /var/log/xenstored-trace.log
> > xenstored: xenstored_core.c:512: send_reply: Assertion `conn->state != 
> > BLOCKED' failed.
> 
> And here's the one-line fix, plus test case.

Thanks for the quick fix!

    christian

> 
> Rusty.
> 
> # HG changeset patch
> # User Rusty Russell <rusty@xxxxxxxxxxxxxxx>
> # Node ID 7882eb8eec92a90929904a9daa7857a2ce44f294
> # Parent  0d8c0db042580571be501be5b59cb5beb8417cef
> Fix Christian's xenstored watch crash.
> 
> When a connection blocked waiting on a transaction, don't queue watch events.
> Sure, they'd be ignored and re-transmitted, but it hits an assert that we 
> don't
> send data out blocked connections, and it's wasteful.
> 
> Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx> (authored)
> 
> diff -r 0d8c0db04258 -r 7882eb8eec92 tools/xenstore/xenstored_watch.c
> --- a/tools/xenstore/xenstored_watch.c        Tue Sep 13 21:52:24 2005
> +++ b/tools/xenstore/xenstored_watch.c        Wed Sep 14 05:07:51 2005
> @@ -144,7 +144,7 @@
>                       else
>                               continue;
>                       /* If connection not doing anything, queue this. */
> -                     if (!i->out)
> +                     if (i->state == OK)
>                               queue_next_event(i);
>               }
>       }
> diff -r 0d8c0db04258 -r 7882eb8eec92 tools/xenstore/xs_test.c
> --- a/tools/xenstore/xs_test.c        Tue Sep 13 21:52:24 2005
> +++ b/tools/xenstore/xs_test.c        Wed Sep 14 05:07:51 2005
> @@ -398,12 +398,16 @@
>  static void do_readack(unsigned int handle)
>  {
>       enum xsd_sockmsg_type type;
> -     char *ret;
> -
> -     ret = read_reply(handles[handle]->fd, &type, NULL);
> -     if (!ret)
> -             failed(handle);
> -     free(ret);
> +     char *ret = NULL;
> +
> +     /* Watches can have fired before reply comes: daemon detects
> +      * and re-transmits, so we can ignore this. */
> +     do {
> +             free(ret);
> +             ret = read_reply(handles[handle]->fd, &type, NULL);
> +             if (!ret)
> +                     failed(handle);
> +     } while (type == XS_WATCH_EVENT);
>  }
>  
>  static void do_setid(unsigned int handle, char *id)
> diff -r 0d8c0db04258 -r 7882eb8eec92 
> tools/xenstore/testsuite/16block-watch-crash.test
> --- /dev/null Tue Sep 13 21:52:24 2005
> +++ b/tools/xenstore/testsuite/16block-watch-crash.test       Wed Sep 14 
> 05:07:51 2005
> @@ -0,0 +1,13 @@
> +# Test case where blocked connection gets sent watch.
> +
> +mkdir /test
> +watch /test token
> +1 start /test
> +# This will block on above
> +noackwrite /test/entry create contents
> +1 write /test/entry2 create contents
> +1 commit
> +readack
> +expect /test/entry2:token
> +waitwatch
> +ackwatch token
> 
> -- 
> A bad analogy is like a leaky screwdriver -- Richard Braakman
> 
> 

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

<Prev in Thread] Current Thread [Next in Thread>