Possible bug in NSCA

Chris Wilson chris at aidworld.org
Fri Oct 7 12:53:44 CEST 2005


Hi Andreas,

On Fri, 2005-09-23 at 08:08, Andreas Ericsson wrote:

> After
> new_sd = accept(sock, 0, 0)
> you should add
> if(new_sd == -1 && errno == EBADF) {
> 	sock = setup_socket();
> }
> 
> Where setup_socket() is an imaginary function that calls socket(), 
> possibly setsockopt(), bind() and listen(), in that order.
> 
> A cleaner solution is to have nsca exit if it can't obtain the socket, 
> since there's no real reason to think it should be able to obtain one later.

This just happened to me again, and I want to fix it.

I would like to propose the attached patch to NSCA. It treats ECHILD
errors the same as EWOULDBLOCK and EINTR, i.e. temporary errors. 

As far as I can see, ECHILD is not documented in the man pages, and
there's no reason to believe that it's a permanent error (i.e. that
accept() will fail next time). I haven't found it in the kernel source
either, but the code for sys_accept is rather convoluted on Linux.

It also ensures that for other errors, NSCA exits cleanly, in a similar
manner to the block below, rather than going into an infinite loop.

Comments most welcome, especially anything that might prevent this from
being accepted into the NSCA source.

I'm installing this on our production server, I'll let you all know if
anything breaks.

Cheers, Chris.
-- 
(aidworld) chris wilson | chief engineer (chris at aidworld.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nsca-noloop.patch
Type: text/x-patch
Size: 793 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/users/attachments/20051007/54a57cd4/attachment.bin>


More information about the Users mailing list