Clean up the stale files

The keystone-api pod gets stuck in CrashLoopBackOff on
AIO-SX lock/unlock attempt.

When Kubernetes decides to kill the keystone-api pod due to readiness
probe failure or other reasons, it calls the preStop hook immediately
before the container is terminated. This hook starts a graceful
shutdown process which includes removing pid, shared memory segment
and wsgi sock files. If the container is not terminated within the
grace period, a SIGKILL is sent, and the container is forced to shut
down.

When the container was forced to terminate without clean up, the
stale files were left behind. On the restart, the application
detected the file existed, and treated it as configuration failure,
hence the exit. As a result, the pod went into a crash loop.

This update removes any stale files when the pod starts.

Story: 2004520
Task: 28392

Change-Id: I613a0db674de9578b3f9d1fa781a1612d9caf214
Signed-off-by: Tao Liu <tao.liu@windriver.com>
This commit is contained in:
Tao Liu 2019-01-12 23:21:53 -05:00
parent ffb531fa70
commit 2462f3015a
2 changed files with 3 additions and 3 deletions

View File

@ -5,4 +5,4 @@ TAR="$TAR_NAME-$SHA.tar.gz"
COPY_LIST="${CGCS_BASE}/downloads/$TAR $PKG_BASE/files/* "
TIS_PATCH_VER=6
TIS_PATCH_VER=7

View File

@ -56,8 +56,8 @@ index 217d942..a5950a4 100644
source /etc/apache2/envvars
fi
+ # Get rid of stale pid file if present.
+ rm -f /var/run/apache2/*.pid
+ # Get rid of stale pid, shared memory segment and wsgi sock files if present.
+ rm -f /var/run/apache2/*
+
# Start Apache2
exec apache2 -DFOREGROUND