FS#29553 - [redis] rc script should remove stale pids

Attached to Project: Community Packages
Opened by Alex B (alexbhr) - Saturday, 21 April 2012, 21:00 GMT
Last edited by Sergej Pupykin (sergej) - Monday, 23 April 2012, 09:28 GMT
Task Type Feature Request
Category Packages
Status Closed
Assigned To Sergej Pupykin (sergej)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

It is possible that a Redis server can die due to memory pressure. The OOM kills it, it segfaults or similar ill fate for it could be just around the corner. Puppet does not take too kind to services that can't figure out they need to restart themselves.

We need a way to see if the PIDFILE no longer contains a fresh process ID. The following is a patch that implements it:

# diff -u rc-redis-orig rc-redis-stale-pid-remove
--- rc-redis-orig 2012-04-21 20:34:20.022877178 +0000
+++ rc-redis-stale-pid-remove 2012-04-21 20:55:42.516233398 +0000
@@ -18,19 +18,20 @@
[ -d $WORKDIR ] || mkdir $WORKDIR

if [ -f $PIDFILE ]; then
+ PID=$(cat $PIDFILE)
+ [ -d /proc/${PID} ] && rm_daemon $daemon_name
+ fi
+
+ $EXEC $CONF >/dev/null
+ if [ $? -gt 0 ]; then
stat_fail
exit 1
else
- $EXEC $CONF >/dev/null
- if [ $? -gt 0 ]; then
- stat_fail
- exit 1
- else
- add_daemon $daemon_name
- stat_done
- fi
+ add_daemon $daemon_name
+ stat_done
fi
- ;;
+
+ ;;

stop)
stat_busy "Stopping $daemon_name"



Additional info:
Redis 2.4.11 is out :)
This task depends upon

Closed by  Sergej Pupykin (sergej)
Monday, 23 April 2012, 09:28 GMT
Reason for closing:  Fixed

Loading...