[Opendnssec-user] File Descriptor Leak in Trunk?

James Dempsey jamespd at gmail.com
Mon Nov 1 02:51:57 UTC 2010


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.

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 {


Cheers,
James Dempsey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opendnssec.org/pipermail/opendnssec-user/attachments/20101101/a5b79506/attachment.htm>


More information about the Opendnssec-user mailing list