From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23183 invoked by alias); 7 Mar 2012 09:32:12 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 16858 Received: (qmail 11392 invoked from network); 7 Mar 2012 09:32:09 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at a.spf.163.com designates 220.181.13.135 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Received:Date:From:To:Cc:Message-ID:In-Reply-To: References:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=Q8wsHNDPJkXr+LApxDfkU1tr27TErUJ1Xo IpaIaSva4=; b=MfQqJesn8HUp6n7/5j2ym1ooBF8e2ONJK7+vbCWX1G8TjgJW4m Wc4SfyU1+ktlabiGKwKG/XDwAnTMzRrSDpBKW4pBbm0yRlwiwjC9/4sRuAdhttGq 9lItfiehqiLCFW8kAGYszImpVbbxABiwxZhXwe/SvUnMohS3B0RscQlXQ= Date: Wed, 7 Mar 2012 17:16:52 +0800 (CST) From: hanpingtian To: "Bart Schaefer" Cc: zsh-users@zsh.org Message-ID: <1061f46a.f12d.135ec725efc.Coremail.hanpingtian@163.com> In-Reply-To: <120306214608.ZM11429@torch.brasslantern.com> References: <120306214608.ZM11429@torch.brasslantern.com> <2c45df49.32a93.135e774fca6.Coremail.hanpingtian@163.com> Subject: Re:Re: job control problem MIME-Version: 1.0 Content-Type: text/plain; charset=GBK Content-Transfer-Encoding: 7bit X-Originating-IP: [96.126.98.8, 96.126.98.8] X-Priority: 3 X-Mailer: Coremail Webmail Server Version SP_ntes V3.5 build 111202(16086.4213.4207) Copyright (c) 2002-2012 www.mailtech.cn 163com X-CM-TRANSID:h8GowEDZ_USFJ1dPw7RDAA--.1755W X-CM-SenderInfo: xkdq1x5qjwxtrq6rljoofrz/xtbB0xFqhUij+ksF8gACsC X-Coremail-Antispam: 1U5529EdanIXcx71UUUUU7vcSsGvfC2KfnxnUU== On Tue, Mar 06, 2012 at 09:46:08PM -0800, Bart Schaefer wrote: > On Mar 6, 6:01pm, hanpingtian wrote: > } > } And I noticed that when trying to run a lot of jobs in background can > } cause zsh quit or frozen. > > Hmm. > > Zsh is attempting to reclaim job table space during the SIGCLD handler. > I did a quick test and somewhere after a few hundred jobs the child > handler gets called during a free(), and the handler then calls free() > again and ends up deadlocked on a system mutex in the guts of glibc. I noticed that sometimes zsh scripts hangs up at futex(), after run some background jobs. > > This is especially likely with "zsh -x" because the PS4 prompt is > allocated and freed each time it's printed. If I leave off the -x, > the whole loop to 10000 runs to completion. > > However, if I try to reproduce this with bash by frobbing "ulimit -u", > bash exits for me at exactly the same point as zsh. In fact we just > had a whole discussion on zsh-workers [*] about bash exiting on fork > failure, and how zsh either did not but ought to, or exited success > when it should probably exit with failure. > > I modified t.sh to echo the loop counter so I cound run it without -x > and still see how many iterations it made. > > schaefer[501] bash --version > GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11) > Copyright (C) 2007 Free Software Foundation, Inc. > schaefer[502] bash /tmp/t.sh > 1 > ... > 67 > /tmp/t.sh: fork: Resource temporarily unavailable > schaefer[503] echo $? > 128 > > No "retry" mentioned. What am I missing? I was using bash 4.2.10 to do this testing: % bash --version GNU bash, version 4.2.10(1)-release (x86_64-redhat-linux-gnu) Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later Looks like the bash will retry again and again. > > > [*] http://www.zsh.org/mla/workers/2012/msg00187.html thread up to > http://www.zsh.org/mla/workers/2012/msg00201.html or so