2

I am experiencing the problem cited in the answer to the below question - having multiple instances of HAProxy created inadvertently, so that the result of netstat -tulpn | grep 80 is several copies of HAProxy listening on a single port.

HAProxy random HTTP 503 errors

I know I can do kill PID# to get rid of the excess instances, but is there a way to prevent them? I see mention of a similar problem here:

https://github.com/haproxy/haproxy/issues/51

But that relates to multiple frontends in a single config. But is there a similar solution - a way to tell HAProxy to not initiate on a port that is already occupied?

Community
  • 1
  • 1
PeterM
  • 439
  • 2
  • 9
  • You shouldn't have to "prevent" this. When does this occur? How are you starting/restarting HAProxy, and what version (`haproxy -v`) are you running? – Michael - sqlbot Jul 26 '16 at 00:14
  • Version: 1.6.7. As for when, immediately on setting up the server. As for how I'm starting it: I'm using Chef provisioning. The sequence of commands is "pm2 kill", update-rc.d -f pm2-init.sh remove" (to get rid of saved inits), "pm2 start [script]", "pm2 save", and "pm2 startup ubuntu -u ubuntu." I also use AWS CodeDeploy to stop and restart the script. There was a mixed-user issue going on that I found after my question and fixed, so that may have been the problem. I'll test more tomorrow and see if I can recreate the problem again. – PeterM Jul 26 '16 at 03:29

1 Answers1

0

Looks like the problem was this:

My provisioner was starting HAProxy with one user, while a deployment system was restarting HAProxy with a separate user - so two copies of HAProxy ended up running. So, of course the solution was to make them both run via the same user.

PeterM
  • 439
  • 2
  • 9