|Monit not able to start after box reboot
|Mon, 11 Jun 2012 16:24:07 -0500
I have seen a problem that monit is not able to start after the box reboot. The monit is run from init as daemon.
This problem happens occasionally. When it does happen, I saw these:
First of all, the .monit.pid file was not removed after the box shutdown.
Then monit was started from init, but it wrote “monit daemon at 12327 awakened” into its log, where 12327 is the pid in .monit.pid.
The monit startup process then exited and no monit process run.
Cleaning up the .monit.pid file helped: restart monit after the cleaning up, then monit came up.
Anyone has experienced this? What could cause this to happen?
Looking at monit’s source code, I found these:
(1) the removal function of the pid file is registered in atexit(), however it may not be called if the process terminates abnormally.
Thus the pid file may not be removed, which is probably what was seen above.
(2) When monit starts up, it retrieves the pid value from the pid file, and calls getpgid to check the result. But if the process with
that pid is running as a zombile, the getpgid checking will pass and monit thinks that the monit daemon is running, and will “awake” that daemon which is actually a zombie. The result is that monit daemon won’t come up.
It doesn’t seem that monit tests if there is a monit zombie process during startup.
Also, if by any chance there is a process running with the same pid in the .monit.pid, monit will send a signal to it to “awake” it
…, and then it may kill that process.
This is seen in monit 5.1.1, and seems to be in the latest version 5.4 as well.
CONFIDENTIALITY AND SECURITY NOTICE
The contents of this message and any attachments may be confidential and proprietary. If you are not an intended recipient, please inform the sender of the transmission error and delete this message immediately without reading, distributing or copying the contents.
|[Prev in Thread]
|[Next in Thread]