On Mon, Apr 30, 2007 at 01:23:23AM +0000, Andy Smith wrote: > Hi, > > I'm trying to use haproxy (http://haproxy.1wt.eu/) to load balance 3 > spamd servers on the same network.
[...]
> Unfortunately I seem to be intermittently getting connection
> failures. The haproxy log looks like this:
>
> Apr 28 05:13:49 localhost haproxy[11683]: Proxy spamd started.
> Apr 28 05:14:57 localhost haproxy[11684]: 212.13.194.70:55827
> [28/Apr/2007:05:14:57] spamd corona 0/0/148 765 -- 0/0/0 0/0
> Apr 28 05:14:57 localhost haproxy[11684]: 212.13.194.70:55828
> [28/Apr/2007:05:14:57] spamd curacao 0/-1/1 0 CC 0/0/0 0/0
It turned out to be a bug in haproxy. I sent an strace to the
author, Willy Tarreau, and he replied in less than 24 hours with a
full annotation of the strace and a patch to fix it. That's
service!
The bug manifested itself when the client would connect, send all
its data and shutdown before haproxy had successfully established a
connection with the backend server. If haproxy managed to establish
a connection before the client fnished sending then it would work
fine. Here's the simple fix:
diff --git a/haproxy.c b/haproxy.c
index 8e57700..357a37a 100644
--- a/haproxy.c
+++ b/haproxy.c
@@ -5589,7 +5589,7 @@ int process_srv(struct session *t) {
else if (s == SV_STCONN) { /* connection in progress */
if (c == CL_STCLOSE || c == CL_STSHUTW ||
(c == CL_STSHUTR &&
- (t->req->l == 0 || t->proxy->options & PR_O_ABRT_CLOSE))) { /*
give up */
+ ((t->req->l == 0 && t->res_sw == RES_SILENT) || t->proxy->options
& PR_O_ABRT_CLOSE))) { /* give up */
tv_eternity(&t->cnexpire);
fd_delete(t->srv_fd);
if (t->srv)
Cheers,
Andy
signature.asc
Description: Digital signature
