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
F166927060: D58788.id184092.diff
Mon, Aug 17, 7:57 PM
Unknown Object (File)
Sun, Aug 16, 9:34 PM
Unknown Object (File)
Sun, Aug 16, 7:13 AM
Unknown Object (File)
Sat, Aug 15, 9:30 PM
Unknown Object (File)
Sat, Aug 15, 7:27 PM
Unknown Object (File)
Sat, Aug 15, 4:13 AM
Unknown Object (File)
Sat, Aug 15, 1:00 AM
Unknown Object (File)
Thu, Aug 13, 10:11 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 75519
Build 72402: arc lint + arc unit

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.