Page MenuHomeFreeBSD

bhyve: monitor: forward SIGTERM to the VM process
ClosedPublic

Authored by novel on Tue, Aug 11, 4:56 PM.
Tags
None
Referenced Files
F167425424: D58788.id184092.diff
Fri, Aug 21, 4:08 PM
Unknown Object (File)
Fri, Aug 21, 10:58 AM
Unknown Object (File)
Thu, Aug 20, 7:35 PM
Unknown Object (File)
Thu, Aug 20, 10:17 AM
Unknown Object (File)
Wed, Aug 19, 4:52 PM
Unknown Object (File)
Wed, Aug 19, 4:11 AM
Unknown Object (File)
Wed, Aug 19, 2:15 AM
Unknown Object (File)
Tue, Aug 18, 8:20 PM

Details

Summary

Currently, sending SIGTERM to the bhyve process triggers ACPI poweroff
for a VM. However, when running bhyve in monitor mode (-M), there are
two processes: the monitor process and the actual VM process. Sending
SIGTERM to the VM process works as before -- it powers off the VM.
But sending SIGTERM to the monitor process just kills the monitor process,
leaving the stale VM process running.

Thus, forward the SIGTERM signal from the monitor process to the
VM process for consistency.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

novel requested review of this revision.Tue, Aug 11, 4:56 PM
markj added a subscriber: markj.

Thanks, I've run into this problem too.

Rather than forwarding signals, why not have a pipe shared between the two processes? The child process can use it to detect when the parent goes away, and exit automatically. That should be simpler and will work for all cases where the parent exits (assertion failure, SIGKILL, etc.).

Thanks, I've run into this problem too.

Rather than forwarding signals, why not have a pipe shared between the two processes? The child process can use it to detect when the parent goes away, and exit automatically. That should be simpler and will work for all cases where the parent exits (assertion failure, SIGKILL, etc.).

+1 for this approach, it's more robust than forwarding signals. I was planning to implement this pipe-based fix soon, but if you have the time and will to do so please go for it!

Thanks, I've run into this problem too.

Rather than forwarding signals, why not have a pipe shared between the two processes? The child process can use it to detect when the parent goes away, and exit automatically. That should be simpler and will work for all cases where the parent exits (assertion failure, SIGKILL, etc.).

+1 for this approach, it's more robust than forwarding signals. I was planning to implement this pipe-based fix soon, but if you have the time and will to do so please go for it!

Pipe is a good idea, I didn't think about that. Will try to implement it, thanks.

Re-implement monitoring using a pipe.

Looks good, thanks. The review title and description are stale now, I presume you will fix them before pushing.

This revision is now accepted and ready to land.Thu, Aug 13, 2:54 PM
This revision was automatically updated to reflect the committed changes.