Domino on Linux/Unix, Troubleshooting, Best Practices, Tips and more ...

alt

Daniel Nashed

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:
  1. Service registers for re-shutdown events
  2. On a reboot or shutdown it stops configured services before reporting back the pre-shutdown operations have been finished
  3. 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.



Links

    Archives


    • [HCL Domino]
    • [Domino on Linux]
    • [Nash!Com]
    • [Daniel Nashed]