yep, I did the same as users usually do :) I should have provided repro
steps. Thank you, Tim, for your patience.


so, repro steps

[root@xxx ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
[root@xxx ~]#

systemd-219-67.el7_7.1.x86_64

haproxy-2.1.2 installed from
https://copr.fedorainfracloud.org/coprs/roidelapluie/haproxy

unit file

[root@xxx ~]# cat /lib/systemd/system/haproxy.service
[Unit]
Description=HAProxy Load Balancer
After=network.target

[Service]
Environment="CONFIG=/etc/haproxy/haproxy.cfg" "PIDFILE=/run/haproxy.pid"
EnvironmentFile=/etc/sysconfig/haproxy
ExecStartPre=/usr/sbin/haproxy -f $CONFIG -c -q
ExecStart=/usr/sbin/haproxy -Ws -f $CONFIG -p $PIDFILE $OPTIONS
ExecReload=/usr/sbin/haproxy -f $CONFIG -c -q
ExecReload=/bin/kill -USR2 $MAINPID
KillMode=mixed
Type=notify

[Install]
WantedBy=multi-user.target
[root@xxx ~]#


case 1, simple config, all works

[root@xxx ~]# cat /etc/haproxy/haproxy.cfg
global
    log         127.0.0.1 local2

    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
    daemon

    # turn on stats unix socket
    stats socket /var/lib/haproxy/stats

    # utilize system-wide crypto-policies
    ssl-default-bind-ciphers PROFILE=SYSTEM
    ssl-default-server-ciphers PROFILE=SYSTEM

defaults
    mode                    http
    log                     global
    option                  httplog
    option                  dontlognull
    option http-server-close
    option forwardfor       except 127.0.0.0/8
    option                  redispatch
    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         10s
    timeout client          1m
    timeout server          1m
    timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 3000

[root@xxx ~]#

[root@xxx ~]# systemctl enable haproxy
[root@xxx ~]# systemctl start haproxy
[root@xxx ~]# systemctl status haproxy
● haproxy.service - HAProxy Load Balancer
   Loaded: loaded (/usr/lib/systemd/system/haproxy.service; enabled; vendor
preset: disabled)
   Active: active (running) since Sun 2020-02-02 20:43:41 MSK; 3s ago
  Process: 2493 ExecStartPre=/usr/sbin/haproxy -f $CONFIG -c -q
(code=exited, status=0/SUCCESS)
 Main PID: 2496 (haproxy)
   CGroup: /system.slice/haproxy.service
           ├─2496 /usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p
/run/haproxy.pid
           └─2499 /usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p
/run/haproxy.pid

Feb 02 20:43:41 xxx systemd[1]: Starting HAProxy Load Balancer...
Feb 02 20:43:41 xxx haproxy[2496]: [NOTICE] 032/204341 (2496) : New worker
#1 (2499) forked
Feb 02 20:43:41 xxx systemd[1]: Started HAProxy Load Balancer.
[root@xxx ~]# systemctl reload haproxy
[root@xxx ~]# systemctl status haproxy
● haproxy.service - HAProxy Load Balancer
   Loaded: loaded (/usr/lib/systemd/system/haproxy.service; enabled; vendor
preset: disabled)
   Active: active (running) since Sun 2020-02-02 20:43:41 MSK; 13s ago
  Process: 2523 ExecReload=/bin/kill -USR2 $MAINPID (code=exited,
status=0/SUCCESS)
  Process: 2521 ExecReload=/usr/sbin/haproxy -f $CONFIG -c -q (code=exited,
status=0/SUCCESS)
  Process: 2493 ExecStartPre=/usr/sbin/haproxy -f $CONFIG -c -q
(code=exited, status=0/SUCCESS)
 Main PID: 2496 (haproxy)
   CGroup: /system.slice/haproxy.service
           ├─2496 /usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p
/run/haproxy.pid -sf 2499
           └─2525 /usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p
/run/haproxy.pid -sf 2499

Feb 02 20:43:41 xxx systemd[1]: Starting HAProxy Load Balancer...
Feb 02 20:43:41 xxx haproxy[2496]: [NOTICE] 032/204341 (2496) : New worker
#1 (2499) forked
Feb 02 20:43:41 xxx systemd[1]: Started HAProxy Load Balancer.
Feb 02 20:43:53 xxx systemd[1]: Reloading HAProxy Load Balancer.
Feb 02 20:43:53 xxx haproxy[2496]: [WARNING] 032/204353 (2496) :
Reexecuting Master process
Feb 02 20:43:53 xxx haproxy[2496]: [WARNING] 032/204353 (2499) : Stopping
frontend GLOBAL in 0 ms.
Feb 02 20:43:53 xxx systemd[1]: Reloaded HAProxy Load Balancer.
Feb 02 20:43:53 xxx haproxy[2496]: [WARNING] 032/204353 (2499) : Proxy
GLOBAL stopped (FE: 0 conns, BE: 0 conns).
Feb 02 20:43:53 xxx haproxy[2496]: [NOTICE] 032/204353 (2496) : New worker
#1 (2525) forked
Feb 02 20:43:54 xxx haproxy[2496]: [WARNING] 032/204354 (2496) : Former
worker #1 (2499) exited with code 0 (Exit)
[root@xxx ~]#


case 2 (dataplane api enabled)

[root@xxx ~]# cat /etc/haproxy/haproxy.cfg
global
    log         127.0.0.1 local2

    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
    daemon
    master-worker

    # turn on stats unix socket
    stats socket /var/lib/haproxy/stats

    # utilize system-wide crypto-policies
    ssl-default-bind-ciphers PROFILE=SYSTEM
    ssl-default-server-ciphers PROFILE=SYSTEM

defaults
    mode                    http
    log                     global
    option                  httplog
    option                  dontlognull
    option http-server-close
    option forwardfor       except 127.0.0.0/8
    option                  redispatch
    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         10s
    timeout client          1m
    timeout server          1m
    timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 3000


userlist controller
  user dataplaneapi insecure-password example

program api
  command dataplaneapi --host 127.0.0.1 --port 5555 --haproxy-bin
/usr/sbin/haproxy --config-file /etc/haproxy/haproxy.cfg --log-to=file
--log-file=/var/log/dataplaneapi.log --log-level=trace --log-format=text
--reload-cmd "systemctl reload haproxy" --reload-delay 5
[root@xxx ~]#


[root@xxx ~]# systemctl enable haproxy
[root@xxx ~]# systemctl start haproxy
[root@xxx ~]# systemctl status haproxy
● haproxy.service - HAProxy Load Balancer
   Loaded: loaded (/usr/lib/systemd/system/haproxy.service; enabled; vendor
preset: disabled)
   Active: active (running) since Sun 2020-02-02 20:49:56 MSK; 3s ago
  Process: 2849 ExecStartPre=/usr/sbin/haproxy -f $CONFIG -c -q
(code=exited, status=0/SUCCESS)
 Main PID: 2851 (haproxy)
   CGroup: /system.slice/haproxy.service
           ├─2851 /usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p
/run/haproxy.pid
           ├─2853 dataplaneapi --host 127.0.0.1 --port 5555 --haproxy-bin
/usr/sbin/haproxy --config-file /etc/haproxy/haproxy.cfg --log-to=file
--log-file=/var/log/dataplaneapi.log --log-level=trace --log-format=te...
           └─2854 /usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p
/run/haproxy.pid

Feb 02 20:49:56 xxx systemd[1]: Starting HAProxy Load Balancer...
Feb 02 20:49:56 xxx haproxy[2851]: [NOTICE] 032/204956 (2851) : New program
'api' (2853) forked
Feb 02 20:49:56 xxx haproxy[2851]: [NOTICE] 032/204956 (2851) : New worker
#1 (2854) forked
Feb 02 20:49:56 xxx systemd[1]: Started HAProxy Load Balancer.
[root@xxx ~]# systemctl reload haproxy
[root@xxx ~]# systemctl status haproxy
● haproxy.service - HAProxy Load Balancer
   Loaded: loaded (/usr/lib/systemd/system/haproxy.service; enabled; vendor
preset: disabled)
   Active: failed (Result: exit-code) since Sun 2020-02-02 20:50:07 MSK; 1s
ago
  Process: 2894 ExecReload=/bin/kill -USR2 $MAINPID (code=exited,
status=0/SUCCESS)
  Process: 2892 ExecReload=/usr/sbin/haproxy -f $CONFIG -c -q (code=exited,
status=0/SUCCESS)
  Process: 2851 ExecStart=/usr/sbin/haproxy -Ws -f $CONFIG -p $PIDFILE
$OPTIONS (code=exited, status=1/FAILURE)
  Process: 2849 ExecStartPre=/usr/sbin/haproxy -f $CONFIG -c -q
(code=exited, status=0/SUCCESS)
 Main PID: 2851 (code=exited, status=1/FAILURE)

Feb 02 20:50:07 xxx haproxy[2851]: [NOTICE] 032/205007 (2851) : New worker
#1 (2897) forked
Feb 02 20:50:07 xxx haproxy[2851]: [ALERT] 032/205007 (2851) : Current
program 'api' (2896) exited with code 1 (Exit)
Feb 02 20:50:07 xxx haproxy[2851]: [ALERT] 032/205007 (2851) :
exit-on-failure: killing every processes with SIGTERM
Feb 02 20:50:07 xxx haproxy[2851]: [ALERT] 032/205007 (2851) : Current
worker #1 (2897) exited with code 143 (Terminated)
Feb 02 20:50:07 xxx haproxy[2851]: [WARNING] 032/205007 (2851) : Former
worker #1 (2854) exited with code 143 (Terminated)
Feb 02 20:50:07 xxx haproxy[2851]: [WARNING] 032/205007 (2851) : Former
program 'api' (2853) exited with code 0 (Exit)
Feb 02 20:50:07 xxx haproxy[2851]: [WARNING] 032/205007 (2851) : All
workers exited. Exiting... (1)
Feb 02 20:50:07 xxx systemd[1]: haproxy.service: main process exited,
code=exited, status=1/FAILURE
Feb 02 20:50:07 xxx systemd[1]: Unit haproxy.service entered failed state.
Feb 02 20:50:07 xxx systemd[1]: haproxy.service failed.
[root@xxx ~]#


вс, 2 февр. 2020 г. в 19:18, Tim Düsterhus <t...@bastelstu.be>:

> Ilya,
>
> Am 02.02.20 um 14:54 schrieb Илья Шипицин:
> > haproxy terminates on "systemctl reload haproxy" (which for example
> happens
> > from within dataplaneapi).
>
> Any error message logged in systemd-journald? Could it be that you hit
> this systemd bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=936032
> ?
>
> Best regards
> Tim Düsterhus
>

Reply via email to