Skip to contentSkip to conversation

Fix another race condition in xm destroy

PATCH In review Anthony Liguori 2 participants 3 messages Sep 16, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix another race condition in xm destroy

There's a race condition in xm destroy that gets triggered when xc_domain_destroy results in a domain disappearing before we invoke the cleanup routines. Specifically, the saveToDB routines will through a No such process error.

Christian, I'd appreciate if you could sanity check this before committing. I think it's okay because starting the cleanup shouldn't have any adverse effects. Having another pair of eyes confirm it would make me feel better though :-)

BTW, this is not the fix for the xm destroy && xm create race condition. Just another one I found in the process.

Regards,

Anthony Liguori

# HG changeset patch
# User [email protected]
# Node ID 2790025adf8eae599d026c9ad6f0b3deacda9b9f
# Parent fd19e760932d095b23d38e67eaec24dd02ba3aba
Fix a race in xm destroy. Once we call xc_domain_destroy, there's no guarentee that the domain will exist (even immediately after the call).

Starting the cleanup before we call destroy will keep us from getting hosed.

tools/python/xen/xend/XendDomainInfo.py +1 -1
diff -r fd19e760932d -r 2790025adf8e tools/python/xen/xend/XendDomainInfo.py
@@ -771,9 +771,9 @@
     def destroy(self):
         """Clenup vm and destroy domain.
         """
-        self.destroy_domain()
         self.cleanup()
         self.saveToDB()
+        self.destroy_domain()
         return 0
 
     def is_terminated(self):

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 9 lines · Anthony Liguori

There's a race condition in xm destroy that gets triggered when xc_domain_destroy results in a domain disappearing before we invoke the cleanup routines. Specifically, the saveToDB routines will through a No such process error.

Christian, I'd appreciate if you could sanity check this before committing. I think it's okay because starting the cleanup shouldn't have any adverse effects. Having another pair of eyes confirm it would make me feel better though :-)

How does it fail for you? I fixed one issue where we were clearing the store event channel and writing that back to the store was failing.

I'd prefer to keep doing the cleanup after destroy_domain.

christian

#2 lore raw
Quoted 15 lines · Christian Limpach
Quoted 11 lines · Anthony Liguori

There's a race condition in xm destroy that gets triggered when xc_domain_destroy results in a domain disappearing before we invoke the cleanup routines. Specifically, the saveToDB routines will through a No such process error.

Christian, I'd appreciate if you could sanity check this before committing. I think it's okay because starting the cleanup shouldn't have any adverse effects. Having another pair of eyes confirm it would make me feel better though :-)

Quoted 5 lines

How does it fail for you? I fixed one issue where we were clearing the store event channel and writing that back to the store was failing.

You're fix solved the problem. That's why I made sure to ask, I wasn't confident my solution was correct :-)

Thanks,

Anthony Liguori

Quoted 6 lines

I'd prefer to keep doing the cleanup after destroy_domain.

christian