« Return to Thread: relayd http check connection failures; hoststated operates correctly

Re: relayd http check connection failures; hoststated operates correctly

by Pierre-Yves Ritschard-4 :: Rate this Message:

Reply to Author | View in Thread

Brad Arrington <bradla@...> wrote:

> Hi Pierre-Yves,
>
> I guess we are both wrong...
> I used a few different timeout values including 1000 before
> changing any code. I just checked relayd(the unpatched version) again
> and I get the same results.
>
> These web servers just serve the default apache index page.
> I can connect to them instantly from the load balancer (using lynx)
> or any other (client)machine
> I have tested.
>
> So either the timeout value is not read/set correctly or it is
> something else.
>
Please try with an insanely high value (10seconds) and see if you still
get a connection timeout message.

To make logging more meaningful you can try with this diff and send me
the relayd -dv output:

Index: check_tcp.c
===================================================================
RCS file: /cvs/src/usr.sbin/relayd/check_tcp.c,v
retrieving revision 1.31
diff -u -p -r1.31 check_tcp.c
--- check_tcp.c 7 Dec 2007 17:17:00 -0000 1.31
+++ check_tcp.c 27 Feb 2008 13:40:45 -0000
@@ -109,21 +109,24 @@ tcp_write(int s, short event, void *arg)
  if (event == EV_TIMEOUT) {
  log_debug("tcp_write: connect timed out");
  cte->host->up = HOST_DOWN;
- } else {
- len = sizeof(err);
- if (getsockopt(s, SOL_SOCKET, SO_ERROR, &err, &len))
- fatal("tcp_write: getsockopt");
- if (err != 0)
- cte->host->up = HOST_DOWN;
- else
- cte->host->up = HOST_UP;
+ close(s);
+ hce_notify_done(cte->host, "tcp_write: connect timed out");
+ return;
  }
 
+ len = sizeof(err);
+ if (getsockopt(s, SOL_SOCKET, SO_ERROR, &err, &len))
+ fatal("tcp_write: getsockopt");
+ if (err != 0)
+ cte->host->up = HOST_DOWN;
+ else
+ cte->host->up = HOST_UP;
+
  if (cte->host->up == HOST_UP)
  tcp_host_up(s, cte);
  else {
  close(s);
- hce_notify_done(cte->host, "tcp_write: connect failed");
+ hce_notify_done(cte->host, "tcp_write: connection refused");
  }
 }

 « Return to Thread: relayd http check connection failures; hoststated operates correctly