Monit postpond incomming action while executing another actions

Issue #22 resolved
Alex Lutay created an issue

Hi,

I am not sure that it is a bug, so lets consider this request as question :-)

Short description: It looks like Monit postponed to process incoming actions (like 'monit restart X' ) while it executing another action (like 'monit start Y') which failed to start.

Question: Is it predictable behaviour of Monit? (Tested in 5.4, 5.6, 5.8 - all the same.)

Full description: As all the companies we do continues integration and run some tests on our trunk code where we use Monit to control the processes (like enable some debug in our configs then tell 'monit restart X'). In normal case monit immediately reacts on request and restart the service.

The problems happen when some of the registered in monit services are failed to start (like a bug in trunk code of component "Y"), in this case monit tries to restart Y more and more and have a problem with reaction on another action 'restart X', if they come in a time of 'starting Y'.

The Monit log with basic explanation from our system is here: http://pastebin.com/RQWgNQcF

the log above was a bit minimised to focus on the issue, full log is here: http://pastebin.com/jiF66N9G

Our X/Y services config looks like this:

check process proxy with pidfile /var/run/kamailio/kamailio.proxy.pid
  start program = "/etc/init.d/kamailio-proxy start"
  stop program = "/etc/init.d/kamailio-proxy safe-stop"
  mode manual
  group sip

Thank you for your answer!

Comments (7)

  1. Tildeslash repo owner

    Hi Alex,

    actions are performed by one thread in current Monit implementation, so the execution is serialized. The start/stop/restart actions are blocking - Monit waits for the process to start/stop for up to 30 seconds by default. As soon as the pending action finished or timed out, Monit continues with next scheduled action.

    If your start/stop program is normally fast, you can shorten the action timeout, for example:

     check process proxy with pidfile /var/run/kamailio/kamailio.proxy.pid
       start program = "/etc/init.d/kamailio-proxy start" with timeout 3 seconds
       stop program = "/etc/init.d/kamailio-proxy safe-stop"
    

    This will reduce the blocking in the case that the process failed to start.

    We work on new Monit kernel, which will have non-blocking engine and will solve the described design limitation.

  2. Tildeslash repo owner

    closing the issue - the limitation is given by current Monit design, will be fixed in the future with new scheduler

  3. Log in to comment