[Pkg-haproxy-maintainers] Bug#726323: haproxy doesn't start on boot due to missing IPv6 address on interface

Philipp Kolmann philipp at kolmann.at
Mon Oct 14 14:07:57 UTC 2013


Package: haproxy
Version: 1.5~dev19-2
Severity: normal
Tags: ipv6

Dear Maintainer,

I have haproxy to do some TCP HA forwarding to LDAP and Exchange Servers. I
also have deployed native IPv6 which works nicely with keepalived and haproxy.

When the system runs and I restart haproxy I never see any issues.
When I reboot the system (kernel update), I see that haproxy fails to start due
to 2 failures:

* haproxy logs to a socket, rsyslogd provides. rsyslogd isn't running, when
  haproxy is started per default. I needed to add $syslogto the Required-Start
  section of the init.d file.

* haproxy doesn't start due to IPv6 host address not set when haproxy is starting.
  I have IPv6 running in production and when haproxy tries to start, it needs
  the host IPv6 address to configure the stick-table. This fails, and haproxy
  fails to start.
  
  my fast-solution is now to add a "sleep 10" to the top of the init.d file,
  but I think a more proper solution would be better.


Also I have changed to init.d file to source a second config file, where I have
the config which both nodes share, so I can easily copy one file.
If you need the config of the global file, please tell me.

thanks
Philipp



-- System Information:
Debian Release: 7.2
  APT prefers stable
  APT policy: (900, 'stable'), (800, 'unstable'), (500, 'stable-updates'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages haproxy depends on:
ii  adduser              3.113+nmu3
ii  init-system-helpers  1.11
ii  libc6                2.17-93
ii  libpcre3             1:8.30-5
ii  libssl1.0.0          1.0.1e-2
ii  zlib1g               1:1.2.7.dfsg-13

haproxy recommends no packages.

Versions of packages haproxy suggests:
pn  vim-haproxy  <none>

-- Configuration Files:
/etc/default/haproxy changed:
ENABLED=1

/etc/haproxy/haproxy.cfg changed:
global
	log /dev/log	local0
	log /dev/log	local1 notice
	chroot /var/lib/haproxy
	user haproxy
	group haproxy
	daemon
	stats socket /var/run/haproxy.sock user root group nagios mode 0660
	stats socket /var/run/haproxy-admin.sock user root group root mode 0600 level admin
        stats bind-process 1
        maxconn     40000
        tune.bufsize    24576
        tune.chksize    24576
defaults
	log	global
	mode	http
	option	httplog
	option	dontlognull
	option	socket-stats
	option  redispatch              # Try another server in case of connection failure
	option  contstats               # Enable continuous traffic statistics updates
	option	abortonclose
        timeout client 7200s                     #alctl: client inactivity
        timeout server 7200s                     #alctl: server inactivity timeout
        timeout connect 5s              # 5 seconds max to connect or to stay in queue
        timeout queue 30s               # 30 seconds max queued on load balancer
	errorfile 400 /etc/haproxy/errors/400.http
	errorfile 403 /etc/haproxy/errors/403.http
	errorfile 408 /etc/haproxy/errors/408.http
	errorfile 500 /etc/haproxy/errors/500.http
	errorfile 502 /etc/haproxy/errors/502.http
	errorfile 503 /etc/haproxy/errors/503.http
	errorfile 504 /etc/haproxy/errors/504.http
listen stats 
	bind 128.130.30.11:80 name IPv4
	bind 2001:629:1005:30::11:80 transparent name IPv6
        mode http
        stats enable
        stats realm Haproxy\ Statistics
        stats uri /
        acl stats-access src 127.0.0.1
        acl stats-access src 128.130.30.11
        acl stats-access src 128.130.30.12
        acl stats-access src 128.130.36.60
        acl stats-access src 128.130.36.61
        acl stats-access src 128.131.225.234
        acl stats-access src 128.131.35.153
        acl stats-access src 2001:629:3800:36:82ee:73ff:fe00:b11c
        block if ! stats-access

/etc/init.d/haproxy changed:
sleep 10
PATH=/sbin:/usr/sbin:/bin:/usr/bin
PIDFILE=/var/run/haproxy.pid
CONFIG=/etc/haproxy/haproxy.cfg
GLOBALCONFIG=/etc/haproxy/haproxy-global.cfg
HAPROXY=/usr/sbin/haproxy
EXTRAOPTS=
ENABLED=0
test -x $HAPROXY || exit 0
if [ -e /etc/default/haproxy ]; then
	. /etc/default/haproxy
fi
test -f "$CONFIG" || exit 0
test -f "$GLOBALCONFIG" || exit 0
test "$ENABLED" != "0" || exit 0
[ -f /etc/default/rcS ] && . /etc/default/rcS
. /lib/lsb/init-functions
haproxy_start()
{
	start-stop-daemon --start --pidfile "$PIDFILE" \
		--exec $HAPROXY -- -f "$CONFIG" -f "$GLOBALCONFIG" -D -p "$PIDFILE" \
		$EXTRAOPTS || return 2
	return 0
}
haproxy_stop()
{
	if [ ! -f $PIDFILE ] ; then
		# This is a success according to LSB
		return 0
	fi
	for pid in $(cat $PIDFILE) ; do
		/bin/kill $pid || return 4
	done
	rm -f $PIDFILE
	return 0
}
haproxy_reload()
{
	$HAPROXY -f "$CONFIG" -f "$GLOBALCONFIG" -p $PIDFILE -D $EXTRAOPTS -sf $(cat $PIDFILE) \
		|| return 2
	return 0
}
haproxy_status()
{
	if [ ! -f $PIDFILE ] ; then
		# program not running
		return 3
	fi
	for pid in $(cat $PIDFILE) ; do
		if ! ps --no-headers p "$pid" | grep haproxy > /dev/null ; then
			# program running, bogus pidfile
			return 1
		fi
	done
	return 0
}
case "$1" in
start)
	log_daemon_msg "Starting haproxy" "haproxy"
	haproxy_start
	ret=$?
	case "$ret" in
	0)
		log_end_msg 0
		;;
	1)
		log_end_msg 1
		echo "pid file '$PIDFILE' found, haproxy not started."
		;;
	2)
		log_end_msg 1
		;;
	esac
	exit $ret
	;;
stop)
	log_daemon_msg "Stopping haproxy" "haproxy"
	haproxy_stop
	ret=$?
	case "$ret" in
	0|1)
		log_end_msg 0
		;;
	2)
		log_end_msg 1
		;;
	esac
	exit $ret
	;;
reload|force-reload)
	log_daemon_msg "Reloading haproxy" "haproxy"
	haproxy_reload
	ret=$?
	case "$ret" in
	0|1)
		log_end_msg 0
		;;
	2)
		log_end_msg 1
		;;
	esac
	exit $ret
	;;
restart)
	log_daemon_msg "Restarting haproxy" "haproxy"
	haproxy_stop
	haproxy_start
	ret=$?
	case "$ret" in
	0)
		log_end_msg 0
		;;
	1)
		log_end_msg 1
		;;
	2)
		log_end_msg 1
		;;
	esac
	exit $ret
	;;
status)
	haproxy_status
	ret=$?
	case "$ret" in
	0)
		echo "haproxy is running."
		;;
	1)
		echo "haproxy dead, but $PIDFILE exists."
		;;
	*)
		echo "haproxy not running."
		;;
	esac
	exit $ret
	;;
*)
	echo "Usage: /etc/init.d/haproxy {start|stop|reload|restart|status}"
	exit 2
	;;
esac
:


-- no debconf information



More information about the Pkg-haproxy-maintainers mailing list