rhel8: bash loops forever trying to reap children, spins on the CPU
Issue
A customer hit a CPU consumption issue within bash, which happens when bash tries to reap a dead child. Taking regularly coredumps, we could see that backtraces show it's spinning in bgp_delete():
#0 0x000055b4ce1a64cf in bgp_delete (pid=pid@entry=2074684) at jobs.c:879
#1 0x000055b4ce1aa7d1 in make_child (command=0x55b4d0c77ed0 "cut -f 1 -d '|'", async_p=async_p@entry=0)
at jobs.c:2104
#2 0x000055b4ce195e98 in execute_simple_command (simple_command=0x55b4d01725a0, pipe_in=pipe_in@entry=3,
pipe_out=pipe_out@entry=-1, async=async@entry=0, fds_to_close=fds_to_close@entry=0x55b4d0d17110)
at /usr/include/bits/string_fortified.h:90
#3 0x000055b4ce1981a6 in execute_command_internal (command=0x55b4d0175140, asynchronous=0, pipe_in=3, pipe_out=-1,
fds_to_close=0x55b4d0d17110) at execute_cmd.c:819
#4 0x000055b4ce19b157 in execute_pipeline (command=command@entry=0x55b4d016c860, asynchronous=asynchronous@entry=0,
pipe_in=pipe_in@entry=-1, pipe_out=pipe_out@entry=-1, fds_to_close=fds_to_close@entry=0x55b4d0d17110)
at execute_cmd.c:2502
[...]
The issues started appearing after fixing BZ #1890888. This issue leads to:
- zombies accumulating
- high CPU consumption
Environment
- Red Hat Enterprise Linux (RHEL) 8, minor releases 1, 2, 3 and 4 affected
- bash
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.