From 665d0a0a333fe075d434bae8f1c1783c9e5b2189 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 17 Feb 2022 15:09:30 +0100 Subject: [PATCH] gpu-setup: Tolerate empty pid files and pid file removal Because job-init is asynchronous to mxqd (see previous commit), job-release races with it, too. Tolerate empty pid files as well as a pid files being removed away from under us. --- helper/gpu-setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helper/gpu-setup b/helper/gpu-setup index e2aff83c..da19fd76 100755 --- a/helper/gpu-setup +++ b/helper/gpu-setup @@ -210,7 +210,7 @@ job_release() { test -d /dev/shm/mxqd/gpu_devs || die "$0: Not initialized (no dir /dev/shm/mxqd/gpu_devs)" for d in /dev/shm/mxqd/gpu_devs/???; do if [ -e $d/pid ]; then - test_pid=$(cat $d/pid) + test_pid="$(cat $d/pid 2>/dev/null)" if [ "$pid" = "$test_pid" ]; then rm $d/pid for f in $(cat $d/access-files); do