monit-dev
[Top][All Lists]
Advanced

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

Re: depend take 2


From: Jan-Henrik Haukeland
Subject: Re: depend take 2
Date: 19 Dec 2002 21:47:01 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Civil Service)

Jan-Henrik Haukeland <address@hidden> writes:

> I want to test and see if it is possible to refactor the depend
> logic a bit before we do a beta release.

It took me a few hours but I have now refactored the depend stuff as
follows:

1) Removed the global dependantlist variable since it was not used,
   (please try to avoid cruft like this in the code!)

2) Added missing garbage collection for a process depend list, too
   avoid memeory leak when restart.

3) Added a sanity check to see if there is a loop in the depend
   "graph" and that all depend names actually referer to a real
   process name

4) Major refactoring of control.c and how dependencies are
   handled. The new functionality is more or less aligned with my
   previously specification. All processes are now started in a
   dependant order and does not wait for subsequent cycles to fix a
   missing start. Depending processes are also stopped in a reverse
   order as they was started.

   Doing the rewriting I have assumed the following scenario:


   (a) WEB-SERVER -> (b) APPLICATION-SERVER -> (c) DATABASE

   The dependencies are, (a) depends on (b) to run before it starts
   and (b) depends on (c) to run before it starts and finally (c) does
   not depend on any process. The corresponding monitrc is:

   check a ..
   depend b

   check b ..
   depend c

   check c ..


   In the following situations this happen:

   1) No servers are running.
       When you run 'monit start' this is the start order: c, b, a

   2) All servers are running.
       When you run 'monit stop' this is the stop order: a, b, c

   3) a does not run
       When you run 'monit start': a is started

   3) b does not run
       When you run 'monit start': b is started, then a is stopped and
       the started again (restarted).
   
   4) c does not run
       When you run 'monit start': c is started, then b is stopped and
       the started again (restarted) and finally a is restarted in the
       same manner.
   
   5) monitrc contains a dependency loop, for examples;  a->b and b->a or
      a->b->c->a. Loop example with controlfile syntax:
      check a ..
      depend b

      check b ..
      depend c

      check c ..
      depend a

       When monit starts it will issue a post check in the parser to
       check for any loops and complain and exit if a depend loop is
       found. It will also exit with a complaint if a depend statement
       was used that does not point to any processes in the
       controlfile.
      

This check-in is a major rewrite and I think we should test this some
more, so maybe we should postpone the planed beta release toworrow? I
also get a lot of ssl errors with regards to send/recieve on sockets
when I reload a changed monitrc file, which I do not like much.

-- 
Jan-Henrik Haukeland



reply via email to

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