Hi,

On 07 06 06, J?rg Streckfu? wrote:
> First a tribut for the good work to the authors of hoststated.
> In the future i plan to use hoststated in production environments
> to check for the availability of our webservices.
> 
> But before I set it up on my production machine I would make some
> testing. I took two tiny Soekrises with OpenBSD 4.1 stable installed,
> configured the first one as loadbalancer and the second one as a webserver
> with three IPs on one interface.
> 
> Here ist the setup in explicit detail:
> 
> 
>       ----------           ----------------         ------------
>       | client |-----------| loadbalancer |---------| webserver |
>       ----------           ----------------         ------------
>       192.168.0.10        192.168.0.1 10.0.0.10     10.0.0.1
>                                                     10.0.0.2
>                                                     10.0.0.3
> 
> my hoststated.conf:
> 
> <snip>
> 
> #
> # Macros
> #
> public_ip="10.0.0.1"
> webhost1="10.0.0.1"
> webhost2="10.0.0.2"
> webhost3="10.0.0.3"
> 
> #
> # Global Options
> #
> interval 15
> timeout 5000
> prefork 1
> log all
> 
> #
> # Each table will be mapped to a pf table.
> #
> table webhosts {
>         real port 443
>         check https "/index.html" code 200
>         host $webhost1
>         host $webhost2
>         host $webhost3
> }
> 
> 
> table fallback {
>         real port 443
>         check https "/index.html" code 200
>         host 127.0.0.1
> }
> 
> #
> # Services will be mapped to a rdr rule.
> #
> service www {
>         virtual host $public_ip port 443
>         table webhosts
>       backup table fallback
> }
> 
> </snip>
> 
> At first everything seemed to work correctly. But when I tried to disable
> one of the webhosts and bring him back after a few seconds, hoststated
> crashed with the following messages in /var/log/deamon:
> 
> <snip>
> Jun  6 11:37:24 loadbalancer hoststated[1333]: fatal: relay_dispatch_pfe:
> desynchronized
> Jun  6 11:37:24 loadbalancer hoststated[5247]: fatal: pfe_dispatch_relay: pipe
> closed
> Jun  6 11:37:24 loadbalancer hoststated[24980]: fatal: main_dispatch_relay:
> pipe closed
> Jun  6 11:37:24 loadbalancer hoststated[12810]: fatal: hce_dispatch_parent:
> pipe closed
> </snip>
> 
> This were the commands which brought hoststated down:
> 
> # hoststatectl host disable 1
> command succeeded
> # hoststatectl host enable 1
> command succeeded
> # hoststatectl show hosts
> hoststatectl: connect: /var/run/hoststated.sock: Connection refused
> 
> So I ask myself, is hoststated already stable enough for production
> environments or should I wait for the release of 4.2 ?

well ;)
probably you will have to wait for 4.2, but fix for similar problem (try
to disable table, then enable it ;)
so probably the same applies for host disabling, enabling...
at least, with this patch it works for me.

--- src/usr.sbin/hoststated/relay.c.orig        Wed Mar  7 19:40:32 2007
+++ src/usr.sbin/hoststated/relay.c     Sun May 13 18:37:48 2007
@@ -1775,7 +1775,7 @@
                                fatalx("relay_dispatch_pfe: invalid host id");
                        if (host->flags & F_DISABLE)
                                break;
-                       if (host->up == st.up) {
+                       if (host->up != st.up) {
                                log_debug("relay_dispatch_pfe: host %d => %d",
                                    host->id, host->up);
                                fatalx("relay_dispatch_pfe: desynchronized");


and since you are not using check tcp, you probably won't notice this ;)

--- src/usr.sbin/hoststated/check_tcp.c.orig    Sun May 13 18:36:36 2007
+++ src/usr.sbin/hoststated/check_tcp.c Sun May 13 18:37:07 2007
@@ -219,6 +219,7 @@
 
        if (event == EV_TIMEOUT) {
                cte->host->up = HOST_DOWN;
+               close(cte->s);
                buf_free(cte->buf);
                hce_notify_done(cte->host, "tcp_read_buf: timeout");
                return;

Reply via email to