Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Combination of pipes and &! leaks file descriptors
- X-seq: zsh-workers 41043
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: Jure Varlec <jure@xxxxxxxxx>, zsh-workers@xxxxxxx
- Subject: Re: Combination of pipes and &! leaks file descriptors
- Date: Wed, 03 May 2017 11:04:33 +0100
- Cms-type: 201P
- In-reply-to: <20170502161925.03e9f794@leopold.lan>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- Organization: Samsung Cambridge Solution Centre
- References: <CGME20170502142014epcas2p3a442db31cf0a8c28b27e89a4cf188e10@epcas2p3.samsung.com> <20170502161925.03e9f794@leopold.lan>
On Tue, 2 May 2017 16:19:25 +0200
Jure Varlec <jure@xxxxxxxxx> 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;
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author