monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is a process started if the dependent file does not exist?


From: Jan-Henrik Haukeland
Subject: Re: Why is a process started if the dependent file does not exist?
Date: Thu, 10 Nov 2005 21:14:17 +0100


On 10. nov. 2005, at 17.33, Claus Klein wrote:

On Thursday 10 November 2005 14:45, Jan-Henrik Haukeland wrote:

On 9. nov. 2005, at 21.50, Claus Klein wrote:

I want to disable the start of a daemon until an barier file exist.
So I tried the following example configuration.

This will not work. The depend feature only make sure that services
are started or stopped in order. There is no sequential wait between
service start.
Ok, thanks,

but I can't understand why the sevice is started every cyle too after the following messssage:

        'crond' service timed out and will not be checked anymore

It's because you have a dependency, this override the timeout and monit will try to restart the timed out service again when it restart the depending process. I think this make sense - better to try one more time if other services depends on this.

Another thing, I'm wondering if it would make better sense if services in a dependency tree _was_ started sequential and that they waited on each other before the next service in the chain started? This means that if the first service in a chain failed to start all the depending services will not be started either, which incidentally also would make your example work.

But I'm not sure though, since the wait-and-move-to-next can only be trigged by a running process having created a pidfile, but since creation of a pidfile is usually done at the very start of a program there may be lots of remaining initialization stuff. I mean, stopping the chain and waiting for a pidfile may not give much more than starting everything at once although in order, which is done today.

It is also arguable if you want to stop the whole service dependency chain if one service cannot start. Lets say you run an appserver that depends on a database server. Even if the database server failed to start you may want to have the appserver running for e.g. serving error-pages. On the other hand, you don't want processes to start if they depend on a file-system or device that isn't there either. Hmm.. food for thought.

Right now dependencies are probably most useful during stop and particularly restart, since during a restart monit _will_ in-fact wait for a service to stop before it moves on to the next service in the chain (it's the start of services that does not wait).

Slightly OT, this wait-continue behavior for stop creates the unwanted side-effect that the httpd server also stops since all this stuff runs in the same thread. I.e. during a service stop the HTTP interface of monit is unresponsive. This is particularly notable if a stop hangs (monit will only timeout the wait after 1 cycle). In other words, sooner or later we need to change the start, stop and restart of services because of this and may at the same time cleanup the dependency stuff if someone have a better design solution, preferably as a patch :)

--
Jan-Henrik Haukeland
Mobil +47 97141255





reply via email to

[Prev in Thread] Current Thread [Next in Thread]