Haproxy dead, but /var/run/haproxy.pid exists

Hi All,

i’m configuring a new haproxy as a smtp and http/s proxy.
As a backend server i have 2 Kerio Connect email server.

all works good, but i have a strange behaviour of haproxy: after receive an email on port 25, haproxy dead.
This is when i start haproxy:
haproxy 17758 0.0 0.1 35192 1600 ? Ss 15:54 0:00 /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -D -p /var/run/haproxy.pid
root 17808 0.0 0.0 10432 672 pts/0 S+ 15:54 0:00 grep --color=auto haproxy

This is after an email on port 25
root 17815 0.0 0.0 10432 672 pts/0 S+ 15:55 0:00 grep --color=auto haproxy

If i try to check the status with service haproxy status:
haproxy dead, but /var/run/haproxy.pid exists.

This is my haproxy conf

log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy

mode tcp
log global
option tcplog
option log-health-checks
option dontlognull
option allbackups
#option forwardfor except
option redispatch
retries 3
timeout connect 5000
timeout client 50000
timeout server 50000
timeout check 10s
maxconn 20000

frontend http
mode http
bind *:80
redirect location https://kerio.cloud.com

frontend https-in
bind *:443
mode http
option tcplog
reqadd X-Forwarded-Proto:\ https
default_backend https-in

backend https-in
mode http
option ssl-hello-chk
balance roundrobin
stick-table type ip size 10M expire 30m
stick on src
cookie SERVERID insert indirect nocache
server node02 77.xxx.xxx.xxx:443 check cookie node02
server node01 77.xxx.xxx.xxx:443 check cookie node01
frontend smtp-in
mode tcp
log global
option tcplog
default_backend smtp_outbound
log-format {“type”:“haproxy”,“timestamp”:%Ts,“http_status”:%ST,“http_request”:"%ci",“bytes_read”:%B,“upstream_addr”:"%si",“backend_name”:"%b",“retries”:%rc,“bytes_uploaded”:%U,“upstream_response_time”:"%Tc",“session_duration”:"%Tt",“termination_state”:"%ts"}
default_backend smtp

backend smtp
mode tcp
log global
balance roundrobin
option smtpchk HELO kerio.cloud.com
option redispatch
server node02 77.xxx.xxx.xxx:25555 check
server node01 77.xxx.xxx.xxx:25555 check

No error in haproxy.log or syslog.

Any idea ?


I would expect to see something if it’s dying in the usual places like /var/log/messages or maybe dmesg output…

I’d suggest simplifying your config as your frontend “smtp-in” seems to mention two default_backend’s “smtp_outbound” and “smtp” but I don’t see any obvious reason for it. Not that I expect that to cause massive problems, it just reads as being odd.

What version of haproxy is it?

Thanks AaronWest.

i remove the 2° default backend…it’s was an error of cut and paste from older conf.
This is my haproxy version

HA-Proxy version 1.6.4 2016/03/13

I found the error in /var/log/syslog

Feb 7 16:22:11 ip-172-31-3-109 kernel: [2845585.787066] haproxy[20076]: segfault at b8 ip 00007f061d9cc347 sp 00007ffd8c1f46b0 error 4 in haproxy[7f061d9a9000+f5000]