Skip to contentSkip to conversation

xm shutdown timeout

DISCUSSION John Levon 3 participants 7 messages May 23, 2007 – May 28, 2007

lore
Share & tools
lore

John Levon

author
#0 lore raw

xend has a timeout such that if an 'xm shutdown' request does not result in the domain shutting down within a certain time period, the domain is violently destroyed.

This seems like a strange choice - if the domain isn't responding properly to such requests, then it must be in a buggy state, and should surely be preserved for administrator action (dumping core, destroying, whatever).

Is there any other purpose to this timeout?

thanks
john

#1 lore raw
Quoted 10 lines · John Levon

xend has a timeout such that if an 'xm shutdown' request does not result in the domain shutting down within a certain time period, the domain is violently destroyed.

This seems like a strange choice - if the domain isn't responding properly to such requests, then it must be in a buggy state, and should surely be preserved for administrator action (dumping core, destroying, whatever).

Is there any other purpose to this timeout?

There are a set of config options to choose what to do on various guest state transitions. I think these are probably what you're looking for. See the final bit of tools/example/xmexample1.

Hmmm... Actually it may be that we unconditionally kill the domain if it ignores shutdown. If that is the case, we should instead force it into whatever the the target of the 'sm shutdown' command was, and then execute the action specified in the config file. We'd like a patch if this is the case. :-)

-- Keir

author
#2 lore raw
Quoted 9 lines · Keir Fraser
Quoted 9 lines

xend has a timeout such that if an 'xm shutdown' request does not result in the domain shutting down within a certain time period, the domain is violently destroyed.

This seems like a strange choice - if the domain isn't responding properly to such requests, then it must be in a buggy state, and should surely be preserved for administrator action (dumping core, destroying, whatever).

Quoted 4 lines
Quoted 1 line

Is there any other purpose to this timeout?

Hmmm... Actually it may be that we unconditionally kill the domain if it ignores shutdown.

if timeout < 0:
log.info(
"Domain shutdown timeout expired: name=%s id=%s", self.info['name_label'], self.domid)
self.destroy()

Quoted 3 lines

If that is the case, we should instead force it into whatever the the target of the 'sm shutdown' command was, and then execute the action specified in the config file.

But this still isn't right. Normally I want the domain destroyed when I do a shutdown (it is, after all, a shutdown). However, if the domain /does not shutdown cleanly/, there are a number of things I might want:

- I might want a core dump, so I can log a bug
- I might want to keep the domain running so I can grab the console and poke around
- it might be some known bug or some strange configuration, and I want it destroyed

This is an abnormal situation and the default on_poweroff/on_reboot settings can't cover it. I believe something along the lines of:

	-self.destroy()

is exactly the correct thing to do.

regards,
john

#3 lore raw
Quoted 3 lines · John Levon

But this still isn't right. Normally I want the domain destroyed when I do a shutdown (it is, after all, a shutdown). However, if the domain /does not shutdown cleanly/, there are a number of things I might want:

Perhaps pushing into state 'crashed' is the right thing to do, and treat that state as a catch-all for exceptional termination conditions?

-- Keir

author
#4 lore raw
Quoted 6 lines · Keir Fraser
Quoted 3 lines

But this still isn't right. Normally I want the domain destroyed when I do a shutdown (it is, after all, a shutdown). However, if the domain /does not shutdown cleanly/, there are a number of things I might want:

Perhaps pushing into state 'crashed' is the right thing to do, and treat that state as a catch-all for exceptional termination conditions?

I considered that. Whilst it's an improvement on what happens now, it still seems like the wrong thing to me: typically a crash will dump core and destroy, meaning I can't then log in and look around (or debug it live from the dom0). I imagine I could set 'preserve', but then I have to preserve real crashes too, which is not likely to be what I want. Since we can't have a new state, it seems like leaving it would be best. Perhaps renaming it to indicate it won't respond to a shutdown request?

regards
john

#5 lore raw
Quoted 10 lines · John Levon
Quoted 2 lines

Perhaps pushing into state 'crashed' is the right thing to do, and treat that state as a catch-all for exceptional termination conditions?

I considered that. Whilst it's an improvement on what happens now, it still seems like the wrong thing to me: typically a crash will dump core and destroy, meaning I can't then log in and look around (or debug it live from the dom0). I imagine I could set 'preserve', but then I have to preserve real crashes too, which is not likely to be what I want. Since we can't have a new state, it seems like leaving it would be best. Perhaps renaming it to indicate it won't respond to a shutdown request?

Why would you want to dump core and destroy for one type of bug, but not for another? Renaming the domain is an okay alternative.

-- Keir

#6 lore raw
In reply to John Levon
Quoted 10 lines

xend has a timeout such that if an 'xm shutdown' request does not result in the domain shutting down within a certain time period, the domain is violently destroyed.

This seems like a strange choice - if the domain isn't responding properly to such requests, then it must be in a buggy state, and should surely be preserved for administrator action (dumping core, destroying, whatever).

Is there any other purpose to this timeout?

As an educated guess: I suspect that the very original intent of this timeout was to put an upperbound on dom0's shutdown time if the xendomains script is being used. This attempts to shutdown all the domains cleanly, but destroys them rudely if they take too long - similar to the usual attempts of init 0 to shut down processes with SIGTERM, following up with SIGKILL...

It would be good to keep this behaviour for shutdown of domain 0, since otherwise there are denial-of-service issues with domUs holding up the reboot arbitrarily long. However, for other scenarios it would be nice not to do this...

Cheers,
Mark

Signature · 4 lines
Dave: Just a question. What use is a unicyle with no seat?  And no pedals!
Mark: To answer a question with a question: What use is a skateboard?
Dave: Skateboards have wheels.
Mark: My wheel has a wheel!