From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: job control problem
Date: Tue, 06 Mar 2012 21:46:08 -0800 [thread overview]
Message-ID: <120306214608.ZM11429@torch.brasslantern.com> (raw)
In-Reply-To: <2c45df49.32a93.135e774fca6.Coremail.hanpingtian@163.com>
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
next prev parent reply other threads:[~2012-03-07 5:46 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 [this message]
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
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=120306214608.ZM11429@torch.brasslantern.com \
--to=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).