--------------------- PatchSet 12261 Date: 2008/06/27 20:55:52 Author: hno Branch: SQUID_2_7 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.63.2.5->1.63.2.6 Index: squid/src/dns_internal.c =================================================================== RCS file: /cvsroot/squid/squid/src/dns_internal.c,v retrieving revision 1.63.2.5 retrieving revision 1.63.2.6 diff -u -r1.63.2.5 -r1.63.2.6 --- squid/src/dns_internal.c 4 May 2008 23:26:36 -0000 1.63.2.5 +++ squid/src/dns_internal.c 27 Jun 2008 20:55:52 -0000 1.63.2.6 @@ -1,6 +1,6 @@ /* - * $Id: dns_internal.c,v 1.63.2.5 2008/05/04 23:26:36 hno Exp $ + * $Id: dns_internal.c,v 1.63.2.6 2008/06/27 20:55:52 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, ".");