From: arisawa <arisawa@ar.aichi-u.ac.jp>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: [9fans] file descriptor leak
Date: Wed, 17 Feb 2016 00:52:37 +0900 [thread overview]
Message-ID: <8FB7CBFD-7334-4F9F-8C71-571DEF9FAD31@ar.aichi-u.ac.jp> (raw)
Hello,
I have observed warning messages from dns server:
dns 30792: warning process exceeded 100 file descriptors
dns 30888: warning process exceeded 200 file descriptors
…
probably the file descriptor leak comes from dnresolve.c
udpquery(Query *qp, char *mntpt, int depth, int patient, int inns)
{
…
msg = system(open("/dev/null", ORDWR), "outside");
…
}
char *
system(int fd, char *cmd)
{
int pid, p, i;
static Waitmsg msg;
if((pid = fork()) == -1)
sysfatal("fork failed: %r");
else if(pid == 0){
dup(fd, 0);
close(fd);
for (i = 3; i < 200; i++)
close(i); /* don't leak fds */
execl("/bin/rc", "rc", "-c", cmd, nil);
sysfatal("exec rc: %r");
}
for(p = waitpid(); p >= 0; p = waitpid())
if(p == pid)
return msg.msg;
return "lost child";
}
fd is lost if pid > 0
my server is running on 9front. however both 9atom and bell-labs use same routine.
Kenji Arisawa
next reply other threads:[~2016-02-16 15:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-16 15:52 arisawa [this message]
2016-02-16 15:56 ` Jacob Todd
2016-02-16 16:42 ` lucio
2016-02-16 17:05 ` Jacob Todd
2016-02-16 17:17 ` Charles Forsyth
2016-02-16 18:01 ` cinap_lenrek
2016-02-16 21:05 ` erik quanstrom
2016-02-16 21:16 ` Charles Forsyth
2016-02-17 2:19 ` cinap_lenrek
2016-02-22 5:18 ` erik quanstrom
2016-02-16 22:24 ` Charles Forsyth
2016-02-17 1:13 ` arisawa
2016-02-17 1:22 ` cinap_lenrek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8FB7CBFD-7334-4F9F-8C71-571DEF9FAD31@ar.aichi-u.ac.jp \
--to=arisawa@ar.aichi-u.ac.jp \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).