Hi,

I ran into the same problem you did, I thought it was something I
was doing wrong until I read your email...

Here is the fix I came up with.

--- check_tcp.c-current Mon Feb 25 15:11:40 2008
+++ check_tcp.c Mon Feb 25 23:48:45 2008
@@ -82,6 +82,7 @@
        if (fcntl(s, F_SETFL, O_NONBLOCK) == -1)
                goto bad;

+       gettimeofday(&cte->table->conf.timeout, NULL);
        bcopy(&cte->table->conf.timeout, &tv, sizeof(tv));
        if (connect(s, (struct sockaddr *)&cte->host->conf.ss, len) == -1) {
                if (errno != EINPROGRESS)

I should check for return codes on gettimeofday but here it is anyway...
I submited a bug report too.

-Brad


> -----Original Message-----
> From: [EMAIL PROTECTED]
> Sent: Fri, 22 Feb 2008 16:16:29 -0800
> To: [email protected]
> Subject: relayd http check connection failures; hoststated operates
> correctly
>
> hello,
>
> perhaps it's something that i'm doing wrong here, or a difference
> in the way that relayd works compared to hoststated. but here
> goes.. i'm attempting to get relayd configured to replace my existing
> hoststated setup, doing layer 7 load balancing of web servers.
>
> what's happening is with every http check done, relayd returns a
> connect failure. in doing a tcpdump i see the session is
> brought up by relayd to the destination servers, the server responds
> with a syn/ack, and then a rst is sent by the system running relayd.
>
> ...
>
> i have a similar hoststated configuration running on the very same
> system, load balancing the very same hosts. it operates as expected,
> with the hosts being seen as up and available.
>
> i have attached relayd debug log output, my relayd configuration
> file, as well as hoststated debug and the hoststated config.
>
> could someone perhaps shed some light on what i'm doing wrong, if
> anything? perhaps a bug in the http check/tcp check code?
>
> if i could be cc'd on any replies, i'd appreciate it. i'm not
> currently subscribed to [EMAIL PROTECTED]
>
> cheers,
>
> -ben
> startup
> init_filter: filter init done
> tcp_write: connect timed out
> relay_privinit: adding relay www
> init_tables: created 0 tables
> hce_notify_done: aa.bb.cc.209 (tcp_write: connect failed)
> protocol 0: name http
> host aa.bb.cc.209, check http code (3ms), state unknown -> down,
> availability 0.00%
>         flags: 0x0004
> tcp_write: connect timed out
>         type: hce_notify_done: aa.bb.cc.211 (tcp_write: connect failed)
> http
> host aa.bb.cc.211, check http code (4ms), state unknown -> down,
> availability 0.00%
>                 pfe_dispatch_imsg: state -1 for host 3 aa.bb.cc.209
> request pfe_dispatch_imsg: state -1 for host 2 aa.bb.cc.211
> append "$SERVER_ADDR:$SERVER_PORT" to "X-Forwarded-By"
>                 request append "$REMOTE_ADDR" to "X-Forwarded-For"
> relay_init: max open files 1024
> relay_init: max open files 1024
> relay_init: max open files 1024
> relay_init: max open files 1024
> relay_init: max open files 1024
> adding 2 hosts from table webhosts:80
> adding 2 hosts from table webhosts:80
> adding 2 hosts from table webhosts:80
> adding 2 hosts from table webhosts:80
> adding 2 hosts from table webhosts:80
> relay_launch: running relay www
> relay_launch: running relay www
> relay_launch: running relay www
> relay_launch: running relay www
> relay_launch: running relay www
> tcp_write: connect timed out
> hce_notify_done: aa.bb.cc.209 (tcp_write: connect failed)
> tcp_write: connect timed out
> hce_notify_done: aa.bb.cc.211 (tcp_write: connect failed)
> ^Chost check engine exiting
> kill_tables: deleted 0 tables
> flush_rulesets: flushed rules
> pf update engine exiting
> socket relay engine exiting
> socket relay engine exiting
> terminating
> [EMAIL PROTECTED] socket relay engine exiting
> socket relay engine exiting
> socket relay engine exiting
> startup
> decremented the demote state of group 'carp'
> init_filter: filter init done
> relay_privinit: adding relay www
> init_tables: created 0 tables
> protocol 0: name http
>         flags: 0x0004
>         type: http
>                 request append "$SERVER_ADDR:$SERVER_PORT" to
> "X-Forwarded-By"
>                 request append "$REMOTE_ADDR" to "X-Forwarded-For"
> relay_init: max open files 1024
> relay_init: max open files 1024
> relay_init: max open files 1024
> relay_init: max open files 1024
> relay_init: max open files 1024
> adding 2 hosts from table http_hosts
> adding 2 hosts from table http_hosts
> adding 2 hosts from table http_hosts
> adding 2 hosts from table http_hosts
> adding 2 hosts from table http_hosts
> relay_launch: running relay www
> relay_launch: running relay www
> relay_launch: running relay www
> relay_launch: running relay www
> relay_launch: running relay www
> hce_notify_done: aa.bb.cc.209 (tcp_read_buf: check succeeded)
> host aa.bb.cc.209, check http code (115ms), state unknown -> up,
> availability 100.00%
> pfe_dispatch_imsg: state 1 for host 1 aa.bb.cc.209
> hce_notify_done: aa.bb.cc.209 (tcp_read_buf: check succeeded)
> host aa.bb.cc.209, check http code (116ms), state unknown -> up,
> availability 100.00%
> pfe_dispatch_imsg: state 1 for host 0 aa.bb.cc.209
> hce_notify_done: aa.bb.cc.209 (tcp_read_buf: check succeeded)
> hce_notify_done: aa.bb.cc.209 (tcp_read_buf: check succeeded)
> ^Chost check engine exiting
> kill_tables: deleted 0 tables
> flush_rulesets: flushed rules
> pf update engine exiting
> socket relay engine exiting
> socket relay engine exiting
> socket relay engine exiting
> socket relay engine exiting
> incremented the demote state of group 'carp'
> terminating
> socket relay engine exiting
> ext_addr="10.10.10.52"
> webhost1="aa.bb.cc.209"
> webhost2="aa.bb.cc.209"
> timeout 800
> prefork 5
> log updates
> demote carp
> table http_hosts {
>         real port http
>         check http "/" host www.mysite.com code 200
>         host $webhost1 retry 2
>         host $webhost2 retry 2
> }
> protocol http {
>         protocol http
>         header append "$REMOTE_ADDR" to "X-Forwarded-For"
>         header append "$SERVER_ADDR:$SERVER_PORT" to "X-Forwarded-By"
>         # Various TCP performance options
>         tcp { nodelay, sack, socket buffer 65536, backlog 128 }
> }
> relay www {
>         listen on $ext_addr port http
>         protocol http
>         table http_hosts loadbalance
> }
> ext_addr="10.10.10.52"
> webhost1="aa.bb.cc.209"
> webhost2="aa.bb.cc.211"
> timeout 800
> table <webhosts> { $webhost1 $webhost2 }
> http protocol http {
>         header append "$REMOTE_ADDR" to "X-Forwarded-For"
>         header append "$SERVER_ADDR:$SERVER_PORT" to "X-Forwarded-By"
>         # header change "Connection" to "close"
>         # Various TCP performance options
>         tcp { nodelay, sack, socket buffer 65536, backlog 128 }
> }
> relay www {
>         listen on $ext_addr port 80
>         protocol http
>         # Forward to hosts in the webhosts table using a src/dst hash
>         forward to <webhosts> port http mode loadbalance \
>                 check http "/" host www.mysite.com code 200
> }
Visit http://www.inbox.com/email to find out more!

Reply via email to