packages: mysql-proxy/mysql-proxy.conf, mysql-proxy/mysql-proxy.init, mysql...

glen glen at pld-linux.org
Mon May 17 20:24:14 CEST 2010


Author: glen                         Date: Mon May 17 18:24:14 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- handle angel mode in initscript, but seems there is something very wrong and broken in the code with signals

---- Files affected:
packages/mysql-proxy:
   mysql-proxy.conf (1.3 -> 1.4) , mysql-proxy.init (1.16 -> 1.17) , mysql-proxy.spec (1.26 -> 1.27) , mysql-proxy.sysconfig (1.8 -> 1.9) 

---- Diffs:

================================================================
Index: packages/mysql-proxy/mysql-proxy.conf
diff -u packages/mysql-proxy/mysql-proxy.conf:1.3 packages/mysql-proxy/mysql-proxy.conf:1.4
--- packages/mysql-proxy/mysql-proxy.conf:1.3	Mon May 17 19:21:15 2010
+++ packages/mysql-proxy/mysql-proxy.conf	Mon May 17 20:24:08 2010
@@ -1,7 +1,8 @@
 [mysql-proxy]
 ## Application options ##
 # Creates a process surrounding the main mysql-proxy which will attempt to restart the true mysql-proxy process
-keepalive = true
+# NOTE: use PROXY_ANGEL="yes" instead in /etc/sysconfig/mysql-proxy
+#keepalive = true
 event-threads = 2
 #max-open-files = 1024
 

================================================================
Index: packages/mysql-proxy/mysql-proxy.init
diff -u packages/mysql-proxy/mysql-proxy.init:1.16 packages/mysql-proxy/mysql-proxy.init:1.17
--- packages/mysql-proxy/mysql-proxy.init:1.16	Mon May 17 19:42:12 2010
+++ packages/mysql-proxy/mysql-proxy.init	Mon May 17 20:24:08 2010
@@ -16,7 +16,9 @@
 
 PROXY_USER="mysqlproxy"
 PROXY_PID="/var/run/mysql-proxy.pid"
+PROXY_ANGEL_PID="/var/run/mysql-proxy-angel.pid"
 PROXY_DEFAULTS_FILE="/etc/mysql-proxy/mysql-proxy.conf"
+PROXY_ANGEL="no"
 
 # Get service config - may override defaults
 [ -f /etc/sysconfig/mysql-proxy ] && . /etc/sysconfig/mysql-proxy
@@ -39,7 +41,14 @@
 	fi
 
 	msg_starting "MySQL Proxy"
-	daemon --redirfds /usr/sbin/mysql-proxy --daemon --user $PROXY_USER --pid-file $PROXY_PID --defaults-file $PROXY_DEFAULTS_FILE $PROXY_OPTIONS
+	if is_yes "$PROXY_ANGEL"; then
+		# --makepid works only with ssd
+		RC_LOGGING="no"
+		daemon --fork --pidfile $PROXY_ANGEL_PID --makepid \
+			/usr/sbin/mysql-proxy --user $PROXY_USER --pid-file $PROXY_PID --defaults-file $PROXY_DEFAULTS_FILE --keepalive $PROXY_OPTIONS
+	else
+		daemon --redirfds /usr/sbin/mysql-proxy --daemon --user $PROXY_USER --pid-file $PROXY_PID --defaults-file $PROXY_DEFAULTS_FILE $PROXY_OPTIONS
+	fi
 	RETVAL=$?
 	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/mysql-proxy
 }
@@ -52,6 +61,9 @@
 
 	# Stop daemons.
 	msg_stopping "MySQL Proxy"
+
+	# use ssd mode, rc-script sends KILL way too early
+	RC_LOGGING="no"
 	killproc --pidfile $PROXY_PID mysql-proxy
 	rm -f /var/lock/subsys/mysql-proxy
 }
@@ -64,6 +76,8 @@
 	fi
 
 	msg_reloading "MySQL Proxy"
+	# send HUP to main (not angel) process, angel seems hitting HUP only once
+	# and then start ignoring it. sigh.
 	killproc --pidfile $PROXY_PID mysql-proxy -HUP
 	RETVAL=$?
 }
@@ -115,7 +129,12 @@
 	flush-logs
 	;;
   status)
-	status mysql-proxy
+	if is_yes "$PROXY_ANGEL"; then
+		nls "Angel process status:"
+		status --pidfile $PROXY_ANGEL_PID mysql-proxy
+	fi
+	nls "Proxy process status:"
+	status --pidfile $PROXY_PID mysql-proxy
 	RETVAL=$?
 	;;
   *)

================================================================
Index: packages/mysql-proxy/mysql-proxy.spec
diff -u packages/mysql-proxy/mysql-proxy.spec:1.26 packages/mysql-proxy/mysql-proxy.spec:1.27
--- packages/mysql-proxy/mysql-proxy.spec:1.26	Mon May 17 19:37:35 2010
+++ packages/mysql-proxy/mysql-proxy.spec	Mon May 17 20:24:08 2010
@@ -2,12 +2,16 @@
 # TODO
 # - system lua-lfs for tests (LuaFileSystem 1.2)
 # - daemon does not close its std fds
-# - with keepalive=yes pidfile contains wrong pid after restarts (it contains
-#   child pid and rc-scripts killing child will make parent guardian process
-#   respawn). in fact you can't even stop normally proxy with keepalive=yes
-#   using initscript.
-#   2010-05-17 20:36:05: (message) chassis.c:223: [angel] PID=22627 died on signal=9 (it used 2 kBytes max) ... waiting 3min before restart
-#   2010-05-17 20:36:05: (message) chassis.c:178: [angel] we try to keep PID=22779 alive
+# - with keepalive=yes (angel mode) killing child with TERM sometimes does
+#   nothing and your restart has to send SIGKILL eventually, seems it's just
+#   losing the signal (some race?).
+#   clock_gettime(CLOCK_MONOTONIC, {8381139, 777478778}) = 0
+#   epoll_wait(6, {}, 8191, 962)            = 0
+#   clock_gettime(CLOCK_MONOTONIC, {8381140, 739212126}) = 0
+#   epoll_wait(6, {}, 8191, 1000)           = 0
+#   clock_gettime(CLOCK_MONOTONIC, {8381141, 742484533}) = 0
+#   - child TERM seems broken in non-angel mode as well (just loses it).
+#   - child HUP seems broken in non-angel mode as well (sees it only once).
 # - tests need fixing (can't find libs it built)
 # OLD TODO
 # - rw splitting bug: http://bugs.mysql.com/bug.php?id=36505
@@ -23,7 +27,7 @@
 Summary(pl.UTF-8):	Proxy MySQL
 Name:		mysql-proxy
 Version:	0.8.0
-Release:	0.14
+Release:	0.15
 License:	GPL
 Group:		Applications/Networking
 Source0:	http://launchpad.net/mysql-proxy/0.8/%{version}/+download/%{name}-%{version}.tar.gz
@@ -209,6 +213,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.27  2010/05/17 18:24:08  glen
+- handle angel mode in initscript, but seems there is something very wrong and broken in the code with signals
+
 Revision 1.26  2010/05/17 17:37:35  glen
 - redirfds is back, problem with angel process
 

================================================================
Index: packages/mysql-proxy/mysql-proxy.sysconfig
diff -u packages/mysql-proxy/mysql-proxy.sysconfig:1.8 packages/mysql-proxy/mysql-proxy.sysconfig:1.9
--- packages/mysql-proxy/mysql-proxy.sysconfig:1.8	Mon May 17 19:09:30 2010
+++ packages/mysql-proxy/mysql-proxy.sysconfig	Mon May 17 20:24:08 2010
@@ -7,5 +7,8 @@
 # Config for defaults, i.e --defaults-file parameter
 #PROXY_DEFAULTS_FILE=/etc/mysql-proxy/mysql-proxy.conf
 
+# Enable angel process (keepalive=yes).
+#PROXY_ANGEL="yes"
+
 # Additional options passed to daemon regardless of defaults file values.
 #PROXY_OPTIONS=""
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/mysql-proxy/mysql-proxy.conf?r1=1.3&r2=1.4&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/mysql-proxy/mysql-proxy.init?r1=1.16&r2=1.17&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/mysql-proxy/mysql-proxy.spec?r1=1.26&r2=1.27&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/mysql-proxy/mysql-proxy.sysconfig?r1=1.8&r2=1.9&f=u



More information about the pld-cvs-commit mailing list