From: Peter Stephenson <p.stephenson@samsung.com>
To: Jure Varlec <jure@varlec.si>, zsh-workers@zsh.org
Subject: Re: Combination of pipes and &! leaks file descriptors
Date: Wed, 03 May 2017 11:04:33 +0100 [thread overview]
Message-ID: <20170503110433.1307fb9b@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <20170502161925.03e9f794@leopold.lan>
On Tue, 2 May 2017 16:19:25 +0200
Jure Varlec <jure@varlec.si> wrote:
> I noticed a file descriptor leak today in a script that was forking
> jobs in a loop and ceased to work after 1000 jobs. A (quick, admittedly)
> search of the mailing list found nothing relevant. A minimal example is
> attached, using `lsof` to demonstrate the problem. I also attached its
> output in case there are difficulties reproducing the problem. It is
> interesting to see that only the `&!` operator causes the problem, the
> `disown` command does not. A pipe needs to be present in the
> backgrounded command.
Thanks, this made it easy to track down.
pws
diff --git a/Src/exec.c b/Src/exec.c
index 9a75dd2..debb0ae 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1612,6 +1612,7 @@ execpline(Estate state, wordcode slcode, int how, int last1)
zclose(opipe[0]);
}
if (how & Z_DISOWN) {
+ pipecleanfilelist(jobtab[thisjob].filelist, 0);
deletejob(jobtab + thisjob, 1);
thisjob = -1;
}
prev parent reply other threads:[~2017-05-03 10:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170502142014epcas2p3a442db31cf0a8c28b27e89a4cf188e10@epcas2p3.samsung.com>
2017-05-02 14:19 ` Jure Varlec
2017-05-03 10:04 ` Peter Stephenson [this message]
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=20170503110433.1307fb9b@pwslap01u.europe.root.pri \
--to=p.stephenson@samsung.com \
--cc=jure@varlec.si \
--cc=zsh-workers@zsh.org \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
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).