Fix killscript regex match for libpod-conmon-*

Whenever a process belongs to libpod-conmon-* scope
instead of libpod-*, wrong container name "conmon" is matched as
the container ID.

That increases memory footprint for neutron-dhcp-agent as it puts
sidecars in an endless loop, since the killscript fails with code 125.
That mostly affects higly loaded systems.

Closes-bug: #1955491
Change-Id: I972fce006c787f91e4a56b1a560d202aa9db46c9
Related: rhbz#2032010
Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
(cherry picked from commit 947b18cf44)
This commit is contained in:
Bogdan Dobrelya 2021-12-22 08:53:54 +01:00
parent ea944a89f0
commit 50a28df085
1 changed files with 1 additions and 1 deletions

View File

@ -52,7 +52,7 @@ signal_container() {
{% raw -%}
if [ -f /proc/$PID/cgroup ]; then
# Get container ID based on process cgroups
CT_ID=$(awk 'BEGIN {FS="[-.]"} /:pids:/{print $3}' /proc/$PID/cgroup)
CT_ID=$(awk 'BEGIN {FS=".scope|-"} /0::|:pids:/ {if ($(NF-1)) print $(NF-1);exit}' /proc/$PID/cgroup)
CT_NAME=$($CLI inspect -f '{{.Name}}' $CT_ID)
case $SIG in