On fre, 2008-06-27 at 13:41 +0100, Bradley Kite wrote: > I have another failure, this time with the extra DNS debug output. > > I have just reliased that our load balancer, which also load-balances > DNS lookups, was not properly configured to support TCP (only UDP DNS > lookups). I think this might be triggering the bug. I will fix this > issue and let you know if this fixes it.
It at least triggers one bug, the high rate and never ending retransmission. But not sure about the user visible bug where the DNS queue apparently stops being processed. In my tests the queue continued getting processed like expected.. or at least I think so.. The attached patch fixes the first issue by letting the retransmit queue recover the query TCP failed instead of immediately trying to resend the query, but I have no idea how to trigger the second.. The queue code looks sane to me. But maybe it fixes that as well...?? Regards Henrik
Index: src/dns_internal.c
===================================================================
RCS file: /cvsroot/squid/squid/src/dns_internal.c,v
retrieving revision 1.69
diff -u -p -r1.69 dns_internal.c
--- src/dns_internal.c 25 Jun 2008 23:24:55 -0000 1.69
+++ src/dns_internal.c 27 Jun 2008 13:48:22 -0000
@@ -706,9 +706,8 @@ idnsReadTcp(int fd, void *data)
return;
}
if (n <= 0) {
- debug(78, 2) ("idnsReadTcp: Short response for %s.\n", q->name);
- dlinkDelete(&q->lru, &lru_list);
- idnsSendQuery(q);
+ debug(78, 1) ("idnsReadTcp: Short response from nameserver %d for %s.\n", ns + 1, q->name);
+ idnsTcpCleanup(q);
return;
}
fd_bytes(fd, n, FD_READ);
@@ -735,8 +734,7 @@ idnsSendTcpQueryDone(int fd, char *bufno
if (errflag == COMM_ERR_CLOSING)
return;
if (errflag) {
- dlinkDelete(&q->lru, &lru_list);
- idnsSendQuery(q);
+ idnsTcpCleanup(q);
return;
}
commSetSelect(q->tcp_socket, COMM_SELECT_READ, idnsReadTcp, q, 0);
@@ -749,8 +747,9 @@ idnsSendTcpQuery(int fd, int status, voi
idns_query *q = data;
short nsz;
if (status != COMM_OK) {
- dlinkDelete(&q->lru, &lru_list);
- idnsSendQuery(q);
+ int ns = (q->nsends - 1) % nns;
+ debug(78, 1) ("idnsSendTcpQuery: Failed to connect to DNS server %d using TCP\n", ns + 1);
+ idnsTcpCleanup(q);
return;
}
memBufInit(&buf, q->sz + 2, q->sz + 2);
@@ -840,7 +839,6 @@ idnsGrokReply(const char *buf, size_t sz
return;
}
if (q->rcode == 3 && q->do_searchpath && q->attempt < MAX_ATTEMPT) {
- assert(NULL == message->answer);
strcpy(q->name, q->orig);
if (q->domain < npc) {
strcat(q->name, ".");
signature.asc
Description: This is a digitally signed message part
