zsh-workers
 help / color / mirror / code / Atom feed
From: Han Pingtian <hanpt@linux.vnet.ibm.com>
To: zsh-workers@zsh.org
Subject: Re: coproc fd leak leading to possible deadlock
Date: Thu, 7 Mar 2013 14:28:36 +0800	[thread overview]
Message-ID: <20130307062836.GA2676@localhost.localdomain> (raw)
In-Reply-To: <20130306225341.GA12150@chaz.gmail.com>

On Wed, Mar 06, 2013 at 10:53:41PM +0000, Stephane Chazelas wrote:
> Side question: is it possible to close any of the coproc pipes?
> >&p- or <&p- don't work.
> 
> If I run another coproc, that closes the current one AFAICT, so I
> can do:
> 
> coproc cmd
> exec {i}<&p {o}>&p
> coproc :
> exec {i}<&-
Interesting, I'm glad to know this. Thanks.
> 
> as a work around, but I thought there should be a simpler way.
> 
> Even when the coproc has terminated, the fds are not closed.
> 
> sc% coproc sleep 10
> [1] 14594
> sc% lsof -ad11-20 -p $$
> COMMAND   PID     USER   FD   TYPE DEVICE SIZE/OFF   NODE NAME
> zsh     12148 chazelas   11r  FIFO    0,8      0t0 295967 pipe
> zsh     12148 chazelas   14w  FIFO    0,8      0t0 295968 pipe
> sc%
> [1]  + done       sleep 10
> sc% lsof -ad11-20 -p $$
> COMMAND   PID     USER   FD   TYPE DEVICE SIZE/OFF   NODE NAME
> zsh     12148 chazelas   11r  FIFO    0,8      0t0 295967 pipe
> zsh     12148 chazelas   14w  FIFO    0,8      0t0 295968 pipe
> 
> Having said that, zsh coproc is a lot more usable that bash's or ksh's. At
> least the issues can easily be worked around.
> 
> -- 
> Stephane


  reply	other threads:[~2013-03-07  6:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-06 22:53 Stephane Chazelas
2013-03-07  6:28 ` Han Pingtian [this message]
2013-03-07 16:58 ` Bart Schaefer

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=20130307062836.GA2676@localhost.localdomain \
    --to=hanpt@linux.vnet.ibm.com \
    --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).