Hi Shelley, Willy,

I can confirm seeing similar on 1.7.1 on FreeBSD amd64, when there was a discrepancy between the backends listed in the state file vs. the ones configured for the new process. I never had time to sort out the precise conditions, rather, shelved the use of the state file in production until I could dig in further.

Best,
Mark Staudinger

On Wed, 14 Jun 2017 17:02:13 -0400, Shelley Shostak <[email protected]> wrote:

Aha. The problem is that the new haproxy.cfg file has hosts that are not in the stat file. If there is no state file, the haproxy.cfg file is perfectly valid.

I've attached a self-contained config file and state file that will reproduce the seg fault. Also the output of haproxy -c using those files. Drop them into /tmp/haproxy for them to work.

Commenting out this line in the defaults section avoids the problem. But the init.d script does a check before stopping haproxy. We don't want to eliminate the check for fear of having no running haproxy.

#  load-server-state-from-file global
reload() {
   $HAPROXY -c -q -f $CONFIG $OPTIONS
   if [ $? -ne 0 ]; then
       echo "Errors in configuration file, check with $HAPROXY check."
       return 1
   fi
   echo -n $"Reloading $HAPROXY: "
   $HAPROXY -D -f $CONFIG -p $PIDFILE $OPTIONS -sf $(cat $PIDFILE)
   retval=$?
   return $retval

On Sun, Jun 11, 2017 at 9:26 AM, Willy Tarreau <[email protected]> wrote:
Hi,

On Tue, May 30, 2017 at 06:14:48PM -0700, Shelley Shostak wrote:
BUG:

Extra spaces inserted into the haproxy.cfg file cause haproxy reload with
saved state to seg fault haproxy.

WORKAROUND:

Remove the existing state file OR remove save state from config.

REPRODUCE:

  - Enable save state across reloads
  - Reload and save state file
  - Insert extra space before "weight".
  - Attempt to reload or validate the new config and haproxy will segv.

There's certainly something else but I have no idea what. The config is
tokenized around spaces so the parser doesn't even know that there are
spaces. This makes me think that the issue could in fact be related to
the position of certain words on the "server" lines, possibly while
comparing with the state file, but even then it looks very strange.

Could you provide a minimal configuration which exhibits the issue for
you ? I've run some tests here but failed to provoke it, so very likely
some other parts of your configuration have an impact to trigger this.

Thanks,
Willy

Reply via email to