[Opendnssec-user] File Descriptor Leak in Trunk?

Sebastian Castro sebastian at nzrs.net.nz
Mon Nov 1 03:54:32 UTC 2010


James Dempsey wrote:
> Hello all,
> 
> I have noticed that in the OpenDNSSEC trunk, ods-signerd accumulates a
> connection to /var/run/opendnssec/engine.sock each time a command is
> issued to the signer.  Eventually, ods-signerd will stop operating when
> the open file limit is reached.
> 

I confirm this behavior. If you run 'ods-signer queue' and later check
using lsof, the number of processes with the engine.sock open is
increased by one.

> strace reveals ods-signerd is doing the following once it hits 1024 open
> files:
> ...
> [pid  4021] select(6, [5], NULL, NULL, NULL) = 1 (in [5])
> [pid  4021] accept(5, 0x7f1109b1ce20, [110]) = -1 EMFILE (Too many open
> files)
> [pid  4021] select(6, [5], NULL, NULL, NULL) = 1 (in [5])
> [pid  4021] accept(5, 0x7f1109b1ce20, [110]) = -1 EMFILE (Too many open
> files)
> ...
> 
> It looks like in ./src/daemon/cmdhandler.c, close is never called on the
> socket that is opened by cmdhandler_start().  The following patch seems
> to resolve the problem for me:
> 
> --- cmdhandler.c (revision 4141)
> +++ cmdhandler.c (working copy)
> @@ -857,6 +857,8 @@
>  void
>  cmdhandler_cleanup(cmdhandler_type* cmdhandler)
>  {
> +    if (cmdhandler->client_fd > 0)
> +        close(cmdhandler->client_fd);
>      if (cmdhandler) {
>          se_free((void*)cmdhandler);
>      } else {
> 

I've tested the patch and solves the issue! Thanks James.

cheers,

> 
> Cheers,
> James Dempsey
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Opendnssec-user mailing list
> Opendnssec-user at lists.opendnssec.org
> https://lists.opendnssec.org/mailman/listinfo/opendnssec-user


-- 
Sebastian Castro
DNS Specialist
.nz Registry Services (New Zealand Domain Name Registry Limited)
desk: +64 4 495 2337
mobile: +64 21 400535



More information about the Opendnssec-user mailing list