Skip to content

Commit dad4f3d

Browse files
colliviermartin-mat
authored andcommitted
Avoid kernel functions that might block when running lsof
It partially reverts "Stop leveraging lsof which may hang when listing sockets" and now leverage -b which causes lsof to avoid kernel functions that might block lstat, readlink, and stat. https://lsof.readthedocs.io/en/stable/faq/ Closes #2331 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
1 parent f32aa38 commit dad4f3d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/modules/cluster_tools/templates/manifest.yml.ecr

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,15 @@ spec:
2222
- /bin/bash
2323
- -c
2424
- |
25-
[ -S /host/run/containerd/containerd.sock ] && ln -s /host/run/containerd /run/containerd
26-
[ -S /host/run/crio/crio.sock ] && ln -s /host/run/crio /run/crio
25+
CONTAINERD_SOCKET_DIR=$(lsof -U -bw | grep -E "/containerd\.sock\s" | awk '{print $9}' | head -n 1 | xargs -r dirname)
26+
if [ -n "$CONTAINERD_SOCKET_DIR" ]; then
27+
ln -s /host/$CONTAINERD_SOCKET_DIR /run/containerd
28+
else
29+
CRIO_SOCKET_DIR=$(lsof -U -bw | grep -E "/crio\.sock\s" | awk '{print $9}' | head -n 1 | xargs -r dirname)
30+
if [ -n "$CRIO_SOCKET_DIR" ]; then
31+
ln -s /host/$CRIO_SOCKET_DIR /var/run/crio
32+
fi
33+
fi
2734
sleep infinity
2835
volumeMounts:
2936
- name: systemd

0 commit comments

Comments
 (0)