--------------------- PatchSet 12276 Date: 2008/06/27 21:11:06 Author: hno Branch: SQUID_2_6 Tag: (none) Log: Bug #2393: DNS requests retried indefinitely at full speed on failed TCP connection Make the retransmit queue deal with TCP errors instead of immediately retransmit the query on a failed TCP connection to the DNS server. TCP is needed on large DNS responses, not fitting within the quite small DNS over UDP maximum packet size. Members: src/dns_internal.c:1.61.2.3->1.61.2.4 Index: squid/src/dns_internal.c =================================================================== RCS file: /cvsroot/squid/squid/src/dns_internal.c,v retrieving revision 1.61.2.3 retrieving revision 1.61.2.4 diff -u -r1.61.2.3 -r1.61.2.4 --- squid/src/dns_internal.c 25 Apr 2008 19:44:50 -0000 1.61.2.3 +++ squid/src/dns_internal.c 27 Jun 2008 21:11:06 -0000 1.61.2.4 @@ -1,6 +1,6 @@ /* - * $Id: dns_internal.c,v 1.61.2.3 2008/04/25 19:44:50 hno Exp $ + * $Id: dns_internal.c,v 1.61.2.4 2008/06/27 21:11:06 hno Exp $ * * DEBUG: section 78 DNS lookups; interacts with lib/rfc1035.c * AUTHOR: Duane Wessels @@ -704,9 +704,8 @@ 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); @@ -733,8 +732,7 @@ 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); @@ -747,8 +745,9 @@ 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); @@ -837,7 +836,6 @@ 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, ".");