1

Yesterday, for around 10 minutes, my haproxy served a lot of 503 pages (directly from errorfile 503 /etc/haproxy/errors/503.http) and I don't know why. I have no health checks to my backends, so for sure these were not marked as disabled. The stats page doesn't show that a limit was reached (in the marked red areas).

haproxy stats page

global
    maxconn 20000
    tune.ssl.default-dh-param 2048
    daemon
    ...

defaults
    log     global
    mode    http
    timeout http-request 30s
    option  httplog
    option  dontlognull
    timeout connect 5s
    timeout server 120s
    timeout client 30s
    ...

frontend frontend_for_all_sites
    maxconn 20000
    mode http
    bind *:80

    option http-buffer-request
    timeout http-request 30s

    ...

    use_backend www_backend      if acl_hostname_www
    use_backend static_backend   if acl_hostname_static

backend www_backend
    option forwardfor
    server www localhost:9090 maxconn 5000

backend static_backend
    option forwardfor
    server s localhost:9090 maxconn 5000

Where should I look at next to figure out why did that happen?

  • 1
    Are you sure localhost:9090 was actually accepting any connections? – kubanczyk Mar 2 '18 at 10:39
  • @kubanczyk I can't really tell. I did a local test, and if it was out of connections or too slow, haproxy would throw a 504 based on the configured timeouts. – cherouvim Mar 2 '18 at 11:48
1

Have you set default_backend ?

If

use_backend www_backend      if acl_hostname_www
use_backend static_backend   if acl_hostname_static

fails, there is not default backend, hence 503

1

It was the backend, and I managed to point out what was happening after adding a %ts (termination_state) in the log-format so I could validate that indeed the backend was unavailable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.