Domino does not shutdown cleanly when Windows is rebooted or shutdown
Daniel Nashed – 9 September 2024 08:30:53
When stopping the Domino service manually, the Windows service control manager (SCM) waits sufficient time to shutdown Domino cleanly.
But it turns out a Windows shutdown or reboot does not wait sufficient time for service termination.
This is critical because it would kill running Domino processes without notice. Even with transaction log enabled, this isn't a desirable situation.
Here is a detailed description how it works in the backend --> https://learn.microsoft.com/en-us/windows/win32/services/service-control-handler-function
The summary of this information is that a service would need to register and handle for SERVICE_CONTROL_PRESHUTDOWN events in addition to a service shutdown event.
It turns out that Windows gives services a very short shutdown of a couple of seconds without this special implementation on shutdown/reboot.
There is an unreliable setting which can extend the time a bit by setting the WaitToKillServiceTimeout registry value. But this would at most limit you to 125 seconds if you are lucky and it still works.
AHA Idea: DOMINO-I-2857 Add SERVICE_CONTROL_PRESHUTDOWN support to Domino Windows Service
There is an enhancement request in the Domino idea portal to get this addressed.
https://domino-ideas.hcltechsw.com/ideas/DOMINO-I-2857
If you are running on Windows and want this to be addressed, please vote.
Helper service to shutdown Windows services cleanly
I wrote a small helper tool to help until Domino supports Windows pre-shutdown.
It provides the following main functionality:
- Service registers for re-shutdown events
- On a reboot or shutdown it stops configured services before reporting back the pre-shutdown operations have been finished
- Wait for a maximum of 10 minutes and terminates as soon all configured services are stopped
The tool is available as Open Source on GitHub --> https://github.com/nashcom/nsh-tools/tree/main/nshshutdown
This might help also for other applications and is a good example how to implement the functionality in existing Windows services.
Some implementation details are not straightforward. I tried to highlight those in the code and the documentation page.
The tool is new and I am still testing it. But it looks good so far.
It comes with some convenient additional functionality like rebooting and also aborting reboots.
Configuration is based on a text file and the logging goes to a log file as well.
- Comments [2]
1Lars Berntrop-Bos 16.09.2024 7:42:01 Domino does not shutdown cleanly when Windows is rebooted or shutdown
Excellent! Thanks for creating this, I wil be deploying!
2Marc Thomas 04.10.2024 9:38:18 Domino does not shutdown cleanly when Windows is rebooted or shutdown
For the Notes client we create something which is called "MCShutdown.exe" This process runs parallel with the Notes Client and is listening for a Windows logoff / shutdown. If this is detected we check if there are still Notes processes up and running. If we see a running Notes client instance we halt the Windows logoff procedure and do a proper/clean shutdown the Notes client. If all client processes are closed we continue the Windows logoff.
This gives us a Notes client in a good and healthy condition even if the user is just logging off or shutting down it´s computer.
Maybe HCL can think about something similar on the server side?
3Daniel Nashed 04.10.2024 12:18:23 Domino does not shutdown cleanly when Windows is rebooted or shutdown
@Marc,
interesting ... shoulds like you are using the same pre-shutdown hooks?
The Domino 14.5 autoinstall service also supports it. But the Domino service does not support it.
That's why I implemented this helper for now.
-- Daniel