[Bug 1822776] Re: Apply Bash 4.4.20 to fix cpu spinning on built-in wait
Robie Basak
1822776 at bugs.launchpad.net
Wed May 29 15:08:40 UTC 2019
** Tags added: bitesize server-next
** Changed in: bash (Ubuntu)
Assignee: (unassigned) => Bryce Harrington (bryce)
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to bash in Ubuntu.
https://bugs.launchpad.net/bugs/1822776
Title:
Apply Bash 4.4.20 to fix cpu spinning on built-in wait
Status in bash package in Ubuntu:
New
Bug description:
Bash pre-4.4.20 has a bug in its PID hash table that causes spin-loops
when spawning sub processes and waiting for them. There is a fix:
https://ftp.gnu.org/gnu/bash/bash-4.4-patches/bash44-020
Our application started being affected (locking up) by this since
migrating from Ubuntu 14.04 to 18.04. Ubuntu 14.04 has bash 4.3.11(1),
Ubuntu 18.04 has bash 4.4.19 (that is, when running 'bash --version',
because of their unusual versions as patches, apt shows it as
4.4.18-2ubuntu1).
The 4.4-020 version needs to be included. I think it's actually quite
critical.
The Bash bug report mentions longer running loops, but it seems hash
collisions are the cause, meaning it's just a matter of chance,
influenced by how fast PIDs are cycled on the machine.
Edit as per the SRU procedure:
[Impact]
Long running bash loops that create and reap processes will crash,
hanging at 100% CPU.
A justification for including the fix would be that a standard
language feature in a script language is broken, and that it's
indeterminate when it breaks. Considering the wide spread use of bash,
I'm surprised not more people have reported issues. My and a client
started having issues with independently of each other very soon after
upgrading to an affected version.
[Test Case]
Run this loop for a few days/weeks:
#!/bin/bash
while true; do
sleep 0.5 &
wait
done
It will cause the 'wait' statement to hang, consuming 100% after some indeterminate amount of time, dependent on how fast PIDs are cycled in the machine.
[Regression Potential]
Using 'apt-get source bash' to get the original source version, I
created a deb that includes the 4.4.20 patch and have been running it
since April 2nd. The 100% CPU spinning is solved, and no other
regressions have been observed.
Ubuntu 18.04 is already at 4.4.19, which is one patch level behind, so
this involves linearly progressing to the next version (so not
skipping patches).
[Other Info]
Official patch to fix, and to bump to 4.4.20:
http://ftp.gnu.org/gnu/bash/bash-4.4-patches/bash44-020
The newest Ubuntu tar.xz with patches I could find at:
http://archive.ubuntu.com/ubuntu/pool/main/b/bash/
also didn't have the 4.4.20 patch, so it seems no Ubuntu release has
the fix yet.
Although not completely sure, this problem seems to have been
introduced in the 4.4 version of Bash, so in term of LTS versions,
18.04 and up are affected.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1822776/+subscriptions
More information about the foundations-bugs
mailing list