Graceful shutdowns

Hello I have a practical question about components lifecycle.

Let me start with some facts about current situation:

  1. Genode doesn’t have SIGHUP signal or any similar alternative to let the child component to know that it’s time to stop/end.
  2. User can kill the child component immediately without waiting for it, claiming it’s memory back to it’s parent.
  3. A child can end itself by calling Parent::exit(exit_value), so parent can stop it, but it is not removed from the composition tree (deployment), and if I got correctly the memory is not released back to the parent.
  4. Many apps/programs are built with advanced state management, that keeps the current state split between memory and FS for performance optimization reasons. And killing them non-gracefully will lead to data inconsistency or corruption. Especially true for more advanced file systems (e.g. ZFS) and data bases.
  5. The official Sculpt docs suggest to make a pause right before clicking reboot or shutdown just to “make sure” all write operations are finished. This looks more like a workaround than a real solution.

Thus these questions:

  1. Is the current lack of graceful shutdowns a deliberate decision or a gap yet to fill?
  2. What should be the usage or development pattern here to align the apps/programs needs with the lack of graceful shutdown in the system? :thinking:
1 Like

Is the current lack of graceful shutdowns a deliberate decision or a gap yet to fill?

It is a gap we aspire to cover in version 27.04. It cannot be rushed but we are gradually working towards that goal. For example, it motivated the VFS redesign work that I personally pursued over the past months, which will enable us to model VFS shutdown as a dynamic VFS reconfiguration to an empty VFS. But this is just one part of the puzzle. Other parts concern the parent protocol, the libc, init, and depot_deploy.

What should be the usage or development pattern here to align the apps/programs needs with the lack of graceful shutdown in the system?

  • Let a component flush cached state in intervals of a few seconds, like how the vfs_rump plugin is operating.
  • If a component holds a lot of internal state that would be too expensive to eagerly sync to disk - like VirtualBox - offer a mechanism for triggering a graceful exit. Given that there is no general hook yet, the trigger must be application-specific. For VirtualBox, this trigger is the closing of the window (observing the GUI mode change to 0x0), which is translated to a VM shutdown via a virtual power button.
2 Likes

Happy to hear that we will have it soon! :smiley:
Thank you for the update and ideas, will think about the temporary solution :+1: