From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 569 invoked by alias); 7 Mar 2012 05:46:35 -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: 16850 Received: (qmail 29018 invoked from network); 7 Mar 2012 05:46:33 -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.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <120306214608.ZM11429@torch.brasslantern.com> Date: Tue, 06 Mar 2012 21:46:08 -0800 In-reply-to: <2c45df49.32a93.135e774fca6.Coremail.hanpingtian@163.com> Comments: In reply to hanpingtian "job control problem" (Mar 6, 6:01pm) References: <2c45df49.32a93.135e774fca6.Coremail.hanpingtian@163.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: job control problem MIME-version: 1.0 Content-type: text/plain; charset=us-ascii 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. 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? [*] http://www.zsh.org/mla/workers/2012/msg00187.html thread up to http://www.zsh.org/mla/workers/2012/msg00201.html or so