Bash loses track of background children sometimes
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
bash (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
Under some circumstances (I've not worked out precisely what), bash can forget about background child processes. For instance, if the file "simpletest" contains:
#! /bin/bash
count=0
while [ $count -lt 51 ]; do
count=
/nonexist
true &
bgpids="$bgpids $!"
done
for pid in $bgpids; do
wait $pid
done
then running "bash simpletest", seems to reliably report "simpletest: line 13: wait: pid 28850 is not a child of this shell" (with different PIDs each time, obviously). Increasing the "51" in the script increases the number of errors. Curiously, removing the call to a nonexistent program causes the problem to stop manifesting.
"getconf CHILD_MAX" returns "undefined", which I think means that Bash should support an unlimited number of unwaited children.
I've observed this on two different amd64 boxes running Ubuntu 10.04 LTS, and it persisted after I upgraded the bash package to 4.2-0ubuntu4. I couldn't reproduce it on an i386 box running Ubuntu 11.04.
ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: bash 4.1-2ubuntu3
ProcVersionSign
Uname: Linux 2.6.32-33-server x86_64
Architecture: amd64
Date: Thu Aug 18 17:04:23 2011
InstallationMedia: Ubuntu-Server 10.04.3 LTS "Lucid Lynx" - Release amd64 (20110719.2)
ProcEnviron:
LANG=en_GB.UTF-8
SHELL=/bin/bash
SourcePackage: bash
Changed in bash (Ubuntu): | |
status: | New → Confirmed |
tags: | added: xenial |
I can confirm this also occurs on Ubuntu 11.04 AMD64.