From: hanpingtian <hanpingtian@163.com>
To: "Bart Schaefer" <schaefer@brasslantern.com>
Cc: zsh-users@zsh.org
Subject: Re:Re: job control problem
Date: Wed, 7 Mar 2012 17:16:52 +0800 (CST) [thread overview]
Message-ID: <1061f46a.f12d.135ec725efc.Coremail.hanpingtian@163.com> (raw)
In-Reply-To: <120306214608.ZM11429@torch.brasslantern.com>
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
<http://gnu.org/licenses/gpl.html>
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
prev parent reply other threads:[~2012-03-07 9:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-06 10:01 hanpingtian
2012-03-07 5:46 ` Bart Schaefer
2012-03-07 13:45 ` Chet Ramey
2012-03-07 17:48 ` Bart Schaefer
2012-03-07 19:23 ` Chet Ramey
2012-03-08 4:25 ` Bart Schaefer
2012-03-07 9:16 ` hanpingtian [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=1061f46a.f12d.135ec725efc.Coremail.hanpingtian@163.com \
--to=hanpingtian@163.com \
--cc=schaefer@brasslantern.com \
--cc=zsh-users@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).