Race condition w/nagios.cmd

Ethan Galstad nagios at nagios.org
Mon Jan 26 00:08:09 CET 2004


Thanks - 

I'll apply the patch to the 1-x branch tonight.  Nagios 2.0 leaves 
the command file around and tries to reuse it when it restarts.

On 23 Jan 2004 at 15:16, Jason Martin wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> There is a race condition regarding the external command fifo when
> Nagios is shutting down. This is especially evident when using nsca in
> inetd mode.  The problem is that the reading end of the fifo closes
> prior to the fifo file being removed. This means that on a busy system
> many nsca processes will attempt to open the fifo in between the
> closing of the pipe and the removal of the fifo. Those nsca processes
> will forever be blocked on the open() of that fifo until they are
> manually killed.
> 
> The fix to this is to unlink the fifo file prior to closing the
> reading end of the pipe.  I've attached a patch to utils.c (from
> nagios-1.1) that reverses the order of the close and unlink to effect
> this.
> 
> Also, is there a particular reason the nagios.cmd file is removed /
> recreated at launch? I'd think it would prevent some problems to have
> it check if an equivalent fifo (ie already has the necessary privs /
> name / properties) already exists, plus remove an annoying problem of
> failing to launch because that file exists from a previous instance.
> 
> Thanks,
> - -Jason Martin


Ethan Galstad,
Nagios Developer
---
Email: nagios at nagios.org
Website: http://www.nagios.org



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn




More information about the Developers mailing list