Watchdog Application Crash
The purpose of the Watchdog Application in a multi process environment is the management of all other Application processes. The Watchdog Application is the parent Application for each newly created Application process.
While it is highly unlikely that the Watchdog will ever die, should that ever happen for what ever reason, N2SVCD will be left in an unmanageable state.
- All existing processes will continue running without a Watchdog to restore them should they crash.
- All existing processes will be orphaned and run under
PID 1
. - N2SVCD can no longer be controlled via
systemctl
orservice
.
In these situations it is recommended that any orphaned processes are terminated and the SHM cleaned up. N2SVCD provides a command line --clean
flag that can be used to achieve this.
Attempting to start a new N2SVCD instance either via the N2SVCD binary or a service
based approach will result in the following error message:
./n2svcd --multi --config /etc/n2svcd/n2svcd.xml
2020-09-07 14:56:32.926011 N2 [NTC]: STARTUP [/etc/n2svcd/n2svcd.xml] MASTER with SHM.
Refusing to initialise SHM IPC '/n2svcd', as it already exists. at ./n2svcd line 770.
When performing a N2SVCD clean operation the config file path that is provided is important as this is used to derive name of the SHM file to access and clear.
For standard N2SVCD installations the default configuration file path will be etc/n2svcd/n2svcd.xml
.
For service
based installations the default configuration file path is used unless this has customized after package installation was completed. Which service configuration file to check depends on the age of the operating system environment.
For systemctl
based systems:
/etc/systemd/system/n2svcd.service
For upstart
based systems:
/etc/init/n2svcd.conf
Using the same configuration file as our previous example we can see the following behavior on a successful cleanup operation:
./n2svcd --multi --config /etc/n2svcd/n2svcd.xml --clean
2020-09-07 14:57:37.165226 N2 [NTC]: Connecting to shared memory area '/n2svcd' for cleanup.
2020-09-07 14:57:37.165344 N2 [NTC]: Cleanup old Application [Manage] by killing PID 1387.
2020-09-07 14:57:37.165422 N2 [NTC]: Cleanup old Application [SOAP-SERVER] by killing PID 1388.
2020-09-07 14:57:37.165506 N2 [NTC]: Cleanup old Application [REST-CLIENT] by killing PID 1389.
2020-09-07 14:57:37.165560 N2 [NTC]: Cleanup old Application [DB-MONGO] by killing PID 1390.
2020-09-07 14:57:37.165620 N2 [NTC]: Cleanup old Application [DIAMETER-01] by killing PID 1391.
2020-09-07 14:57:37.165697 N2 [NTC]: Cleanup old Application [DIAMETER-02] by killing PID 1392.
2020-09-07 14:57:37.165910 N2 [NTC]: Cleanup old Application [Logic] by killing PID 1395.
2020-09-07 14:57:37.165972 N2 [NTC]: Dropping shared memory area '/n2svcd' as part of explicit cleanup.
This will load the SHM associated with the provided configuration file and check if any of the PIDs still exist for the registered Applications found within. If any are still alive they will be killed, after which the SHM file will be removed from the system. Once completed N2SVCD can be restarted, either from the command line or a system restart
command.