Re: relayd http check fix
Rivo Nurges(rivo.nur...@smit.ee) on 2018.04.06 10:44:20 +: > Hi! > > ping > > Rivo thanks for reminding me, and thanks for the diff. committed. /Benno > On Wed, 2018-03-28 at 16:56 +, Rivo Nurges wrote: > > Hi! > > > > If relayd http check doesn't get any answer to its http check it > > marks > > backend host as up. > > > > host x.y.z, check http code (2010ms,tcp read timeout), state down -> > > up, availability 14.29% > > > > sample config: > > relay test { > > listen on x.x.x.x port > > forward to port check http "/" code 200 > > } > > > > sample server: > > while :;do nc -l ;done > > > > fix: > > Index: usr.sbin/relayd/check_tcp.c > > === > > RCS file: /cvs/src/usr.sbin/relayd/check_tcp.c,v > > retrieving revision 1.55 > > diff -u -p -r1.55 check_tcp.c > > --- usr.sbin/relayd/check_tcp.c 4 Jul 2017 20:27:09 - > > 1.55 > > +++ usr.sbin/relayd/check_tcp.c 28 Mar 2018 16:45:38 - > > @@ -243,8 +243,10 @@ tcp_read_buf(int s, short event, void *a > > if (event == EV_TIMEOUT) { > > if (ibuf_size(cte->buf)) > > (void)cte->validate_close(cte); > > - else > > + else { > > cte->host->he = HCE_TCP_READ_TIMEOUT; > > + cte->host->up = HOST_DOWN; > > + } > > tcp_close(cte, cte->host->up == HOST_UP ? 0 : > > HOST_DOWN); > > hce_notify_done(cte->host, cte->host->he); > > return; > > >
Re: relayd http check fix
Hi! ping Rivo On Wed, 2018-03-28 at 16:56 +, Rivo Nurges wrote: > Hi! > > If relayd http check doesn't get any answer to its http check it > marks > backend host as up. > > host x.y.z, check http code (2010ms,tcp read timeout), state down -> > up, availability 14.29% > > sample config: > relay test { > listen on x.x.x.x port > forward to port check http "/" code 200 > } > > sample server: > while :;do nc -l ;done > > fix: > Index: usr.sbin/relayd/check_tcp.c > === > RCS file: /cvs/src/usr.sbin/relayd/check_tcp.c,v > retrieving revision 1.55 > diff -u -p -r1.55 check_tcp.c > --- usr.sbin/relayd/check_tcp.c 4 Jul 2017 20:27:09 - > 1.55 > +++ usr.sbin/relayd/check_tcp.c 28 Mar 2018 16:45:38 - > @@ -243,8 +243,10 @@ tcp_read_buf(int s, short event, void *a > if (event == EV_TIMEOUT) { > if (ibuf_size(cte->buf)) > (void)cte->validate_close(cte); > - else > + else { > cte->host->he = HCE_TCP_READ_TIMEOUT; > + cte->host->up = HOST_DOWN; > + } > tcp_close(cte, cte->host->up == HOST_UP ? 0 : > HOST_DOWN); > hce_notify_done(cte->host, cte->host->he); > return; >
relayd http check fix
Hi! If relayd http check doesn't get any answer to its http check it marks backend host as up. host x.y.z, check http code (2010ms,tcp read timeout), state down -> up, availability 14.29% sample config: relay test { listen on x.x.x.x port forward to port check http "/" code 200 } sample server: while :;do nc -l ;done fix: Index: usr.sbin/relayd/check_tcp.c === RCS file: /cvs/src/usr.sbin/relayd/check_tcp.c,v retrieving revision 1.55 diff -u -p -r1.55 check_tcp.c --- usr.sbin/relayd/check_tcp.c 4 Jul 2017 20:27:09 - 1.55 +++ usr.sbin/relayd/check_tcp.c 28 Mar 2018 16:45:38 - @@ -243,8 +243,10 @@ tcp_read_buf(int s, short event, void *a if (event == EV_TIMEOUT) { if (ibuf_size(cte->buf)) (void)cte->validate_close(cte); - else + else { cte->host->he = HCE_TCP_READ_TIMEOUT; + cte->host->up = HOST_DOWN; + } tcp_close(cte, cte->host->up == HOST_UP ? 0 : HOST_DOWN); hce_notify_done(cte->host, cte->host->he); return;