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/
Home Products Support Community News


[Xen-API] [PATCH 0 of 3] Work around race in the domain shutdown code

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH 0 of 3] Work around race in the domain shutdown code
From: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Thu, 17 Dec 2009 14:09:14 +0000
Delivery-date: Thu, 17 Dec 2009 06:09:19 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
Work around race in the domain shutdown code.

When we previously changed the code to drop the per-VM mutex when requesting a 
domain shuts itself down (control/shutdown=x) we deliberately made it possible 
for a shutdown via the API to race with a shutdown triggered externally, via 
the event thread. We fixed this by making the destroy code check to see whether 
the domain had already been restarted and retry if so.

Unfortunately (i) we didn't add a delay into the retry loop allowing it to busy 
loop; and (ii) it turns out that calling Xc.domain_shutdown doesn't guarantee 
that subsequent Xc.domain_getinfo calls see the new state-- this triggered the 
retry (busy)loop.

Work around this by adding a 5s delay to the retry loop. Note that this is 
triggered very rarely in my testing: 1000 shutdowns triggered the retry twice.

Signed-off-by: David Scott <dave.scott@xxxxxxxxxxxxx>
2 files changed, 15 insertions(+), 6 deletions(-)
ocaml/xapi/events.ml  |    8 ++++----
ocaml/xapi/xapi_vm.ml |   13 +++++++++++--

xen-api mailing list