Re: -sf/-st not working

2013-02-07 Thread Marc-Antoine Perennou
It is totally normal that systemd kills the new process as the main one
which was the first has exited. This is the expected behaviour.

I'm currently patching haproxy to fully support systemd, I'll probably
submit my patches by tomorrow (It's fully functionnal here, only needs a
little cleaning)


On 7 February 2013 16:31, Eugene Istomin  wrote:

> **
>
> I think the main problem is in systemd:
>
>
>
> - from commandline -sf working as expected
>
> - from sysvinit -sf working as expected
>
> - from systemd -sf only stop process.
>
>
>
> I try both init.d & systemd scripts in systemd-based linux - all results
> are the same:
>
>
>
> Loaded: loaded (/lib/systemd/system/haproxy.service; disabled)
>
> Active: failed (Result: signal) since Thu, 07 Feb 2013 17:18:43 +0200;
> 12s ago
>
> Process: 28125 ExecReload=/usr/sbin/haproxy -D -f
> /etc/haproxy/haproxy.cfg -p /var/run/haproxy.pid -sf $MAINPID (code=exited,
> status=0/SUCCESS)
>
> Process: 28118 ExecStart=/usr/sbin/haproxy -D -f /etc/haproxy/haproxy.cfg
> -p /var/run/haproxy.pid (code=exited, status=0/SUCCESS)
>
> Process: 28115 ExecStartPre=/usr/sbin/haproxy -c -q -f
> /etc/haproxy/haproxy.cfg (code=exited, status=0/SUCCESS)
>
> Main PID: 28126 (code=killed, signal=KILL)
>
> CGroup: name=systemd:/system/haproxy.service
>
>
>
>
>
> systemd script:
>
> [Unit]
>
> Description=HAProxy For TCP And HTTP Based Applications
>
> After=network.target
>
>
>
> [Service]
>
> Type=forking
>
> PIDFile=/var/run/haproxy.pid
>
> ExecStartPre=/usr/sbin/haproxy -c -q -f /etc/haproxy/haproxy.cfg
>
> ExecStart=/usr/sbin/haproxy -D -f /etc/haproxy/haproxy.cfg -p
> /var/run/haproxy.pid
>
> ExecReload=/usr/sbin/haproxy -D -f /etc/haproxy/haproxy.cfg -p
> /var/run/haproxy.pid -sf $MAINPID
>
>
>
> [Install]
>
> WantedBy=multi-user.target
>
>
>
> --
>
> Best regards,
>
> Eugene Istomin
>
>
>
>
> On Thursday 07 February 2013 14:07:44 Baptiste wrote:
>
> > You should have a new HAProxy process started using the new
>
> > configuration and binding the ports...
>
> >
>
> > cheers
>
> >
>
> > On 2/7/13, Eugene Istomin  wrote:
>
> > > Thanks for the answer,
>
> > >
>
> > > as written in
>
> > > http://www.mgoff.in/2010/04/18/haproxy-reloading-your-config-with-
>
> > > minimal-service-impact/
>
> > > "The end-result is a reload of the configuration file which is not
> visible
>
> > > by
>
> > > the customer"
>
> > >
>
> > > But in our case it leads to unbinding from all ports and finishing
> haproxy
>
> > > process.
>
> > > Can this issue related to rpm build options? RPM build log is
>
> > >
> https://build.opensuse.org/package/rawlog?arch=x86_64&package=haproxy-1.5&;
>
> > > project=server%3Ahttp&repository=openSUSE_12.2
>
> > >
>
> > >
>
> > > --
>
> > > Best regards,
>
> > > Eugene Istomin
>
> > >
>
> > > On Thursday 07 February 2013 07:28:17 Willy Tarreau wrote:
>
> > >> Hello Eugene,
>
> > >>
>
> > >> On Wed, Feb 06, 2013 at 08:29:33PM +0200, Eugene Istomin wrote:
>
> > >> > Hello,
>
> > >> >
>
> > >> > We have problem with reload/HUP:
>
> > >> > if i run #/usr/sbin/haproxy -D -f /etc/haproxy/haproxy.cfg -p
>
> > >> > /var/run/haproxy.pid -sf $(cat /var/run/haproxy.pid) - haproxy
> process
>
> > >> > is
>
> > >> > shutting down and exit
>
> > >>
>
> > >> This is the intended behaviour, it unbinds from its ports so that the
> new
>
> > >> process can bind, then waits for all existing connections to terminate
>
> > >> and leaves. Isn't it what you're observing ? What would you have
> expected
>
> > >> instead ?
>
> > >>
>
> > >> Willy
>


Re: -sf/-st not working

2013-02-07 Thread Eugene Istomin
I think the main problem is in systemd: 

- from commandline -sf working as expected
- from sysvinit -sf working as expected
- from systemd -sf  only stop process.

I try both init.d & systemd scripts in systemd-based linux - all results are 
the same:

  Loaded: loaded (/lib/systemd/system/haproxy.service; disabled)
  Active: failed (Result: signal) since Thu, 07 Feb 2013 17:18:43 +0200; 12s 
ago
  Process: 28125 ExecReload=/usr/sbin/haproxy -D -f /etc/haproxy/haproxy.cfg -
p /var/run/haproxy.pid -sf $MAINPID (code=exited, status=0/SUCCESS)
  Process: 28118 ExecStart=/usr/sbin/haproxy -D -f /etc/haproxy/haproxy.cfg -p 
/var/run/haproxy.pid (code=exited, status=0/SUCCESS)
  Process: 28115 ExecStartPre=/usr/sbin/haproxy -c -q -f 
/etc/haproxy/haproxy.cfg (code=exited, status=0/SUCCESS)
Main PID: 28126 (code=killed, signal=KILL)
  CGroup: name=systemd:/system/haproxy.service


systemd script:
[Unit]
Description=HAProxy For TCP And HTTP Based Applications
After=network.target

[Service]
Type=forking
PIDFile=/var/run/haproxy.pid
ExecStartPre=/usr/sbin/haproxy -c -q -f /etc/haproxy/haproxy.cfg
ExecStart=/usr/sbin/haproxy -D -f /etc/haproxy/haproxy.cfg -p 
/var/run/haproxy.pid
ExecReload=/usr/sbin/haproxy -D -f /etc/haproxy/haproxy.cfg -p 
/var/run/haproxy.pid -sf $MAINPID

[Install]
WantedBy=multi-user.target

-- 
Best regards,
Eugene Istomin


On Thursday 07 February 2013 14:07:44 Baptiste wrote:
> You should have a new HAProxy process started using the new
> configuration and binding the ports...
> 
> cheers
> 
> On 2/7/13, Eugene Istomin  wrote:
> > Thanks for the answer,
> > 
> > as written in
> > http://www.mgoff.in/2010/04/18/haproxy-reloading-your-config-with-
> > minimal-service-impact/
> > "The end-result is a reload of the configuration file which is not visible
> > by
> > the customer"
> > 
> > But in our case it leads to unbinding from all ports and finishing haproxy
> > process.
> > Can this issue related to rpm build options? RPM build log is
> > https://build.opensuse.org/package/rawlog?arch=x86_64&package=haproxy-1.5&;
> > project=server%3Ahttp&repository=openSUSE_12.2
> > 
> > 
> > --
> > Best regards,
> > Eugene Istomin
> > 
> > On Thursday 07 February 2013 07:28:17 Willy Tarreau wrote:
> >> Hello Eugene,
> >> 
> >> On Wed, Feb 06, 2013 at 08:29:33PM +0200, Eugene Istomin wrote:
> >> > Hello,
> >> > 
> >> > We have problem with reload/HUP:
> >> > if i run #/usr/sbin/haproxy -D -f /etc/haproxy/haproxy.cfg -p
> >> > /var/run/haproxy.pid -sf $(cat /var/run/haproxy.pid)  - haproxy process
> >> > is
> >> > shutting down and exit
> >> 
> >> This is the intended behaviour, it unbinds from its ports so that the new
> >> process can bind, then waits for all existing connections to terminate
> >> and leaves. Isn't it what you're observing ? What would you have expected
> >> instead ?
> >> 
> >> Willy

Re: -sf/-st not working

2013-02-07 Thread Baptiste
You should have a new HAProxy process started using the new
configuration and binding the ports...

cheers

On 2/7/13, Eugene Istomin  wrote:
> Thanks for the answer,
>
> as written in
> http://www.mgoff.in/2010/04/18/haproxy-reloading-your-config-with-
> minimal-service-impact/
> "The end-result is a reload of the configuration file which is not visible
> by
> the customer"
>
> But in our case it leads to unbinding from all ports and finishing haproxy
> process.
> Can this issue related to rpm build options? RPM build log is
> https://build.opensuse.org/package/rawlog?arch=x86_64&package=haproxy-1.5&project=server%3Ahttp&repository=openSUSE_12.2
>
>
> --
> Best regards,
> Eugene Istomin
>
>
> On Thursday 07 February 2013 07:28:17 Willy Tarreau wrote:
>> Hello Eugene,
>>
>> On Wed, Feb 06, 2013 at 08:29:33PM +0200, Eugene Istomin wrote:
>> > Hello,
>> >
>> > We have problem with reload/HUP:
>> > if i run #/usr/sbin/haproxy -D -f /etc/haproxy/haproxy.cfg -p
>> > /var/run/haproxy.pid -sf $(cat /var/run/haproxy.pid)  - haproxy process
>> > is
>> > shutting down and exit
>>
>> This is the intended behaviour, it unbinds from its ports so that the new
>> process can bind, then waits for all existing connections to terminate
>> and leaves. Isn't it what you're observing ? What would you have expected
>> instead ?
>>
>> Willy



Re: -sf/-st not working

2013-02-07 Thread Eugene Istomin
Thanks for the answer,

as written in http://www.mgoff.in/2010/04/18/haproxy-reloading-your-config-with-
minimal-service-impact/
"The end-result is a reload of the configuration file which is not visible by 
the customer"

But in our case it leads to unbinding from all ports and finishing haproxy 
process.
Can this issue related to rpm build options? RPM build log is  
https://build.opensuse.org/package/rawlog?arch=x86_64&package=haproxy-1.5&project=server%3Ahttp&repository=openSUSE_12.2
 

-- 
Best regards,
Eugene Istomin


On Thursday 07 February 2013 07:28:17 Willy Tarreau wrote:
> Hello Eugene,
> 
> On Wed, Feb 06, 2013 at 08:29:33PM +0200, Eugene Istomin wrote:
> > Hello,
> > 
> > We have problem with reload/HUP:
> > if i run #/usr/sbin/haproxy -D -f /etc/haproxy/haproxy.cfg -p
> > /var/run/haproxy.pid -sf $(cat /var/run/haproxy.pid)  - haproxy process is
> > shutting down and exit
> 
> This is the intended behaviour, it unbinds from its ports so that the new
> process can bind, then waits for all existing connections to terminate
> and leaves. Isn't it what you're observing ? What would you have expected
> instead ?
> 
> Willy

Re: -sf/-st not working

2013-02-06 Thread Willy Tarreau
Hello Eugene,

On Wed, Feb 06, 2013 at 08:29:33PM +0200, Eugene Istomin wrote:
> Hello,
> 
> We have problem with reload/HUP:
> if i run #/usr/sbin/haproxy -D -f /etc/haproxy/haproxy.cfg -p
> /var/run/haproxy.pid -sf $(cat /var/run/haproxy.pid)  - haproxy process is
> shutting down and exit

This is the intended behaviour, it unbinds from its ports so that the new
process can bind, then waits for all existing connections to terminate
and leaves. Isn't it what you're observing ? What would you have expected
instead ?

Willy




-sf/-st not working

2013-02-06 Thread Eugene Istomin
Hello,

We have problem with reload/HUP:
if i run #/usr/sbin/haproxy -D -f /etc/haproxy/haproxy.cfg -p 
/var/run/haproxy.pid -sf $(cat /var/run/haproxy.pid)  - haproxy process is 
shutting down and exit

from strace:
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 4
fcntl(4, F_SETFL, O_RDONLY|O_NONBLOCK)  = 0
setsockopt(4, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
setsockopt(4, SOL_SOCKET, 0xf /* SO_??? */, [1], 4) = -1 ENOPROTOOPT (Protocol 
not available)
bind(4, {sa_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr("0.0.0.0")}, 
16) = -1 EADDRINUSE (Address already in use)
close(4)= 0
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 4
fcntl(4, F_SETFL, O_RDONLY|O_NONBLOCK)  = 0
setsockopt(4, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
setsockopt(4, SOL_SOCKET, 0xf /* SO_??? */, [1], 4) = -1 ENOPROTOOPT (Protocol 
not available)
bind(4, {sa_family=AF_INET, sin_port=htons(443), 
sin_addr=inet_addr("0.0.0.0")}, 16) = -1 EADDRINUSE (Address already in use)
close(4)= 0
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 4
fcntl(4, F_SETFL, O_RDONLY|O_NONBLOCK)  = 0
setsockopt(4, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
setsockopt(4, SOL_SOCKET, 0xf /* SO_??? */, [1], 4) = -1 ENOPROTOOPT (Protocol 
not available)
setsockopt(4, SOL_TCP, TCP_DEFER_ACCEPT, [1], 4) = 0
bind(4, {sa_family=AF_INET, sin_port=htons(6000), 
sin_addr=inet_addr("0.0.0.0")}, 16) = -1 EADDRINUSE (Address already in use)
close(4) 

.

select(0, NULL, NULL, NULL, {0, 1}) = 0 (Timeout)
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 4
fcntl(4, F_SETFL, O_RDONLY|O_NONBLOCK)  = 0
setsockopt(4, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
setsockopt(4, SOL_SOCKET, 0xf /* SO_??? */, [1], 4) = -1 ENOPROTOOPT (Protocol 
not available)
bind(4, {sa_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr("0.0.0.0")}, 
16) = 0
listen(4, 2000) = 0
setsockopt(4, SOL_TCP, TCP_QUICKACK, [0], 4) = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 5
fcntl(5, F_SETFL, O_RDONLY|O_NONBLOCK)  = 0
setsockopt(5, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
setsockopt(5, SOL_SOCKET, 0xf /* SO_??? */, [1], 4) = -1 ENOPROTOOPT (Protocol 
not available)
bind(5, {sa_family=AF_INET, sin_port=htons(443), 
sin_addr=inet_addr("0.0.0.0")}, 16) = 0
listen(5, 2000)

.

rt_sigaction(SIGTTOU, {0x459110, [TTOU], SA_RESTORER|SA_RESTART, 
0x7ff38ba41da0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTTIN, {0x459110, [TTIN], SA_RESTORER|SA_RESTART, 
0x7ff38ba41da0}, {SIG_DFL, [], 0}, 8) = 0
unlink("/var/run/haproxy.pid")  = 0
open("/var/run/haproxy.pid", O_WRONLY|O_CREAT|O_TRUNC, 0644) = 11
kill(22708, SIGUSR1)= 0
getrlimit(RLIMIT_NOFILE, {rlim_cur=40036, rlim_max=40036}) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, 
child_tidptr=0x7ff38cc549d0) = 22716
write(11, "22716\n", 6) = 6
close(11)   = 0
exit_group(0)   = ?
+++ exited with 0 +++


#haproxy -V
HA-Proxy version 1.5-dev17 2012/12/28

-- 
Best regards,
Eugene Istomin