monit-dev
[Top][All Lists]
Advanced

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

Re: Sendmail code...


From: Martin Pala
Subject: Re: Sendmail code...
Date: Sat, 11 Oct 2003 09:12:52 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030930 Debian/1.4-5

Christian Hopp wrote:

Moin!

After I read the discussion about the Timeout issue earlier I thought
again about the sendmail code.  And I don't like how it is
right... cuz mail which have trouble being delivered simply get lost
and all you get is a syslog/logfile entry.  IMO, that doesn't really
fit to monit concept robustness.

Why not a simple(!) queue based sendmail thread...  Whenever a mail
has to be send you append it to a chained list and give it time()
ticket and a retry counter.  The event code isn't blocked anyhow, as
long as no access is being done to the mail queue.

The implementation can use pthread condition variables for waiting and
signalling.  Whenever the sendmail thread has worked itself through
the whole queue it sets itself asleep with pthread_cond_timedwait for
a period of time (like daemontime).  In case a mail is being put in
the mail queue.  The thread is woken up by pthread_cond_signal and the
thread tries to send out all the mails which have been appended to the
queue.  If the condition times out, the thread works itself through
the whole queue from the beginning.

Pursuing this way no mail monit has tried to send out is getting lost
(as long monit is not shutdown).  Higher network timeouts won't block
monits code.

I have played around little bit with condition variable and I think
it's a with feasible way to implement it.

So, what do you think???

I agree. It is generaly described in todo list already:

--8<--
Message queue support
If no of MTA servers are available, store alert messages in a queue for later delivery.
--8<--

I think the design as you outlined seems good - the separate thread for message delivery makes sense.

...



I am on vacation starting Sunday for one week... (-:  FINALLY!!!

Have a nice vacation :)

Martin





reply via email to

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