[Top][All Lists]

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

Re: Question on the dependency of processes

From: Jan-Henrik Haukeland
Subject: Re: Question on the dependency of processes
Date: Mon, 14 Mar 2005 18:43:21 +0100

On Mar 14, 2005, at 15:38, Yiwen Jiang wrote:

I am not sure if this is the proper news group that I should post this question to, as there are monit implementation questions in this email...

You should really take implementation issues to the monit-developer list. But..

What I have found was that the order in the monitrc file for monitoring these proceeses generate different 'servicelist' content (in the source code). For example, the content of servicelist (when in validate.c::validate() to check for zombie processes) is different if the processes are listed in reverse order in the monitrc file.

For example, say I have a service dependency tree like:
Where as A is the 'root of the tree.

In my monitrc file, I have 'check process' in the following order: E, F, D, C, B, G, A.

If I turn debug on using -v option, the checks on the zombie processes are in the order of: G, F, E, D, C, B, A

If I reverse the order in the monitrc file, and restart monit using -v option, the checks on the zombie processes are in the order of: E, F, D, C, B, G, A. This is in a different result than the previous one.

The list is initially built during parsing and reshuffled afterwards if dependencies are present. Because of this the final list may look different if you change the order of the service entries. Note however that in both cases the reshuffling is done so the leaf nodes are first in the list.

I went through the code, and noticed that the 'servicelist' is actually re-organized based on the dependencies after the configuration file is parsed.. However, the result yield the most visited process to be the last on the servicelist.

I don't quite understand why the the most visited process is not at the beginning of the list. If my understanding is correct, validate goes through the servicelist, to check process status every poll interval. If we think of a scenario where because process A crashed, process G exited. The current behaviour will result in G being restarted before A, despite the dependency.

Hmm you have a point there, although the end result should be the same it seems that you got one unnecessary restart of G. Have you verified that this is the case? Browsing the code it does indeed look that way.

Would it not make more sense to have the servicelist constructed the other way where the most dependent process be the first process on the servicelist?

Because of the dependencies between these processes, it really only make sense to me if monit would check for the 'root' process first. Or am I mis-using monit?

I don't remember why we ended up having the service list with the least depending services first. It may be other scenarios that justify this design, although no one comes to mind right now. Could you implement a test case with the most depending services first in the list and verify that dependencies continue to work as described in the monit manual? If it does, we'll certainly reverse the service list and accept a patch from you or fix it ourself.

Jan-Henrik Haukeland
Mobil +47 97141255

reply via email to

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