-
-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix shutdown hooks not running #338
Conversation
sig.c was calling plugin_run_hooks for the shutdown hooks, but the shutdown hooks do not have registered callbacks in hook-scripts.c Instead directly call plugin_script_run()
Curious, when I recently implemented this I made sure to test all these cases, and it still works for me without your change. There's a piece of code to ensure scripts are called this late (or early at bootstrap): Lines 243 to 252 in 910dac5
I wanted to ensure all hooks are called using the same API, in case of future changes. Having different entry points is hard to manage over time. However, I'm inclined to pull in your patch anyway. Perhaps even extend upon it to do the same for the early hook points as well, for symmetry. But first I'm very curious to understand why the current code doesn't work in your case -- feels like there's something else hidden here. |
Just had a random thought about this and will have to check on Monday. This probably goes unnoticed since /var gets mounted over it immediately (and then the startup scripts run) so everything continues as normal. Hence once all the filesystems are unmounted, that If my hunch is correct it's probably a my-bad, although I'd argue that a bad folder structure, or failure to unmount /var shouldn't stop the shutdown scripts from running. |
Ah, yeah I think I ran into the same issue. Both The |
Ahh. So If I manually
I am guessing this file is getting created before Note adding the commits 8bbae3d and c22d123 mentioned above don't fix this. I would guess Lines 247 to 252 in 02a110e
return in it, or Lines 261 to 266 in 02a110e
cond_is_available() so that this symlink doesn't get created by cond_set_oneshot() .But making those changes will stop /var/run getting mounted in the first place.
Its a bit above my paygrade now. But either way having a umount failure shouldn't stop the shutdown scripts from running. |
Awesome, that's exactly what I was looking for, thanks! Explains a lot that this happens on a system where Yeah you're right, I'll have to look into those places, and build on this PR as well to improve robustness at shutdown, as well as boot (in case someone starts with a messed up rootsfs ...) Thank you so much for helping find the root cause! |
As pointed out by Jack Newman in issue #338, when conditions are not available (at boot before cond_init(), or shutdown when /var or /var/run have been unmounted) we should not try to create any conditions. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
There, should work better now. I've adjusted the boundaries for calling Turns out Great to find and nail this one down before the next release! |
Does that change work for you? |
What does your filesystem layout look like? The recommended one is "new" style dedicated mount point for Finit only mounts Lines 390 to 405 in 02a110e
|
Updated the docs a bit to detail the fs recommendations. Hope it helps: https://github.com/troglobit/finit/tree/master/doc#filesystem-layout |
Found it. Looks like a few years ago whoever created the Swapped the symlink around and now everything mounts as expected. Cheers |
Nice find, and excellent news! Yup, that sounds very likely from what I saw myself. Glad to hear it all worked out 😃 |
The shutdown hooks do not have any registered callbacks. So calling
plugin_run_hooks()
ends up doing nothing.I think it makes sense to handle these special case hook scripts like this, but not sure if skipping some of the extra checks in
plugin_run_hooks()
makes a difference. I am guessing we don't care about thecond_set()
andservice_step()
calls when everything has already exited.