--------------------- PatchSet 4694 Date: 2007/06/03 12:58:31 Author: amosjeffries Branch: squid3-ipv6 Tag: (none) Log: Add notes on another segfault bug. Remove some fluff added with last commit. Members: NOTES-IPv6:1.1.2.30->1.1.2.31 include/IPAddress.h:1.1.2.21->1.1.2.22 src/ACLARP.cc:1.9.4.10->1.9.4.11 src/client_db.cc:1.5.4.13->1.5.4.14 src/comm.cc:1.47.2.34->1.47.2.35 src/neighbors.cc:1.23.4.21->1.23.4.22 Index: squid3/NOTES-IPv6 =================================================================== RCS file: /cvsroot/squid-sf//squid3/Attic/NOTES-IPv6,v retrieving revision 1.1.2.30 retrieving revision 1.1.2.31 diff -u -r1.1.2.30 -r1.1.2.31 --- squid3/NOTES-IPv6 3 Jun 2007 12:14:41 -0000 1.1.2.30 +++ squid3/NOTES-IPv6 3 Jun 2007 12:58:31 -0000 1.1.2.31 @@ -1,4 +1,4 @@ -$Id: NOTES-IPv6,v 1.1.2.30 2007/06/03 12:14:41 amosjeffries Exp $ +$Id: NOTES-IPv6,v 1.1.2.31 2007/06/03 12:58:31 amosjeffries Exp $ KNOWN BUGS: @@ -37,6 +37,49 @@ (repeated twice so far) +PROBLEM: Segmentation fault retrieving hash key of address. +Stack Trace: +#0 0xb7d6c68a in strcmp () from /lib/tls/i686/cmov/libc.so.6 +#1 0x081284f3 in hash_lookup (hid=0x8346550, k=0x8573c58) at hash.c:191 +#2 0x0808b395 in idnsCachedLookup (key=, callback=0, data=0x8573c58) at dns_internal.cc:1312 +#3 0x0808c4b3 in idnsALookup (name=0x8573c58 "shots.snap.com", callback=0x80c8040 , data=0x854c080) + at dns_internal.cc:1344 +#4 0x080d59bb in netdbPingSite (hostname=0x852e32c "shots.snap.com") at net_db.cc:946 +#5 0x08096f17 in FwdState::dispatch (this=0x85882a8) at forward.cc:938 +#6 0x08097bb3 in FwdState::connectStart (this=0x85882a8) at forward.cc:795 +#7 0x080da126 in peerSelectFoo (ps=0x858c358) at peer_select.cc:239 +#8 0x08052034 in ACLChecklist::checkCallback (this=0x85800e0, answer=ACCESS_ALLOWED) at ACLChecklist.cc:273 +#9 0x08052347 in ACLChecklist::check (this=0x85800e0) at ACLChecklist.cc:162 +#10 0x080da21c in peerSelectFoo (ps=0x858c358) at peer_select.cc:310 +#11 0x08098613 in FwdState::start (this=0x85882a8, aSelf=@0xbf8e6554) at forward.cc:121 +#12 0x080989ac in FwdState::fwdStart (client_fd=13, entry=0xb7c0c9ac, request=0x852e260) at forward.cc:276 +#13 0x0807e07b in clientReplyContext::processMiss (this=0xb7ac106c) at client_side_reply.cc:711 +#14 0x0807e75d in clientReplyContext::identifyStoreObject (this=0xb7ac106c) at client_side_reply.cc:1379 +#15 0x0808108f in ClientHttpRequest::httpStart (this=0x856cd30) at client_side_request.cc:911 +#16 0x08082005 in ClientHttpRequest::doCallouts (this=0x856cd30) at client_side_request.cc:1079 +#17 0x08052034 in ACLChecklist::checkCallback (this=0x8580010, answer=ACCESS_ALLOWED) at ACLChecklist.cc:273 +#18 0x0805221e in ACLChecklist::check (this=0x8580010) at ACLChecklist.cc:184 +#19 0x08081215 in ClientRequestContext::checkNoCache (this=0x857be70) at client_side_request.cc:859 +#20 0x08081e62 in ClientHttpRequest::doCallouts (this=0x856cd30) at client_side_request.cc:1052 +#21 0x08082d57 in ClientRequestContext::clientAccessCheckDone (this=0x857be70, answer=1) at client_side_request.cc:482 +#22 0x08052034 in ACLChecklist::checkCallback (this=0x857ff40, answer=ACCESS_ALLOWED) at ACLChecklist.cc:273 +#23 0x08052347 in ACLChecklist::check (this=0x857ff40) at ACLChecklist.cc:162 +#24 0x08081255 in ClientRequestContext::clientAccessCheck (this=0x857be70) at client_side_request.cc:390 +#25 0x08081b17 in ClientHttpRequest::doCallouts (this=0x856cd30) at client_side_request.cc:1015 +#26 0x08076414 in clientProcessRequest (conn=@0xbf8e6e84, hp=, context=0xb7ae3044, method=METHOD_GET, http_ver= + {major = 1, minor = 1}) at client_side.cc:2276 +#27 0x08077b6d in clientParseRequest (conn=@0xbf8e6e84, do_next_read=@0xbf8e6e8b) at client_side.cc:2398 +#28 0x08078e84 in clientReadRequest (fd=13, buf=0xb7b87008 "GET http://shots.snap.com/shot_main_js/v2.7.2/ HTTP/1.1\r\nHost: shots.snap.com\r\nUser-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20061201 Firefox/2.0.0.3 (Ubuntu-feisty)\r\nAccept: *"..., size=475, flag=COMM_OK, xerrno=0, data=0x8560948) + at client_side.cc:2489 +#29 0x08106a7e in commio_call_callback (ccb=0x8320b38) at comm.cc:209 +#30 0x08106aaa in commio_call_callbacks () at comm.cc:219 +#31 0x08106ae0 in CommDispatcher::dispatch (this=0xbf8e7030) at comm.cc:2584 +#32 0x080917f4 in EventLoop::runOnce (this=0xbf8e6fec) at EventLoop.cc:131 +#33 0x080918da in EventLoop::run (this=0xbf8e6fec) at EventLoop.cc:100 +#34 0x080cb01e in main (argc=4, argv=0xbf8e70e4) at main.cc:1315 + + + cache.log lines detected showing possible problems: (after a request for http://[2001:200:0:8002:203:47ff:fea5:3085]/ ) Index: squid3/include/IPAddress.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/include/Attic/IPAddress.h,v retrieving revision 1.1.2.21 retrieving revision 1.1.2.22 diff -u -r1.1.2.21 -r1.1.2.22 --- squid3/include/IPAddress.h 3 Jun 2007 12:14:41 -0000 1.1.2.21 +++ squid3/include/IPAddress.h 3 Jun 2007 12:58:32 -0000 1.1.2.22 @@ -1,6 +1,6 @@ /* - * $Id: IPAddress.h,v 1.1.2.21 2007/06/03 12:14:41 amosjeffries Exp $ + * $Id: IPAddress.h,v 1.1.2.22 2007/06/03 12:58:32 amosjeffries Exp $ * * DEBUG: section 14 IP Storage and Handling * AUTHOR: Amos Jeffries @@ -293,7 +293,7 @@ * Get RFC 3493 addrinfo structure from the IPAddress data * for protocol-neutral socket operations. * Should be passed a NULL pointer of type struct addrinfo* it will - * allocate memory for teh structures involved. (see FreeAddrInfo to clear). + * allocate memory for the structures involved. (see FreeAddrInfo to clear). * Defaults to a TCP streaming socket, if other values (such as UDP) are needed * the caller MUST override these default settings. * Some situations may also require an actual call to the system getaddrinfo() Index: squid3/src/ACLARP.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ACLARP.cc,v retrieving revision 1.9.4.10 retrieving revision 1.9.4.11 diff -u -r1.9.4.10 -r1.9.4.11 --- squid3/src/ACLARP.cc 3 Jun 2007 12:14:45 -0000 1.9.4.10 +++ squid3/src/ACLARP.cc 3 Jun 2007 12:58:32 -0000 1.9.4.11 @@ -1,5 +1,5 @@ /* - * $Id: ACLARP.cc,v 1.9.4.10 2007/06/03 12:14:45 amosjeffries Exp $ + * $Id: ACLARP.cc,v 1.9.4.11 2007/06/03 12:58:32 amosjeffries Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -226,9 +226,9 @@ ACLARP::match(ACLChecklist *checklist) { /* IPv6 does not do ARP */ - if(!c.IsIPv4()) + if(!checklist->src_addr.IsIPv4()) { - debugs(14, 3, "ACLARP::match: IPv4 Required for ARP Lookups. Skipping " << c ); + debugs(14, 3, "ACLARP::match: IPv4 Required for ARP Lookups. Skipping " << checklist->src_addr ); return 0; } Index: squid3/src/client_db.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_db.cc,v retrieving revision 1.5.4.13 retrieving revision 1.5.4.14 diff -u -r1.5.4.13 -r1.5.4.14 --- squid3/src/client_db.cc 3 Jun 2007 12:14:45 -0000 1.5.4.13 +++ squid3/src/client_db.cc 3 Jun 2007 12:58:32 -0000 1.5.4.14 @@ -1,6 +1,6 @@ /* - * $Id: client_db.cc,v 1.5.4.13 2007/06/03 12:14:45 amosjeffries Exp $ + * $Id: client_db.cc,v 1.5.4.14 2007/06/03 12:58:32 amosjeffries Exp $ * * DEBUG: section 0 Client Database * AUTHOR: Duane Wessels @@ -394,7 +394,7 @@ if (current) { - crrent->NtoA(key,MAX_IPSTRLEN); + current->NtoA(key,MAX_IPSTRLEN); hash_first(client_table); while ((c = (ClientInfo *) hash_next(client_table))) { Index: squid3/src/comm.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/comm.cc,v retrieving revision 1.47.2.34 retrieving revision 1.47.2.35 diff -u -r1.47.2.34 -r1.47.2.35 --- squid3/src/comm.cc 3 Jun 2007 12:14:46 -0000 1.47.2.34 +++ squid3/src/comm.cc 3 Jun 2007 12:58:32 -0000 1.47.2.35 @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.47.2.34 2007/06/03 12:14:46 amosjeffries Exp $ + * $Id: comm.cc,v 1.47.2.35 2007/06/03 12:58:32 amosjeffries Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -722,23 +722,18 @@ { statCounter.syscalls.sock.recvfroms++; int x = 0; - // this type is used as the largest of the two which may be needed. - // actual details returned from recvfrom will determin the use. - struct sockaddr_in6 from_addr; - size_t sz = sizeof(struct sockaddr_in6); - memset(&from_addr, 0, sz); // MUST be pre-initialised to NULL. + struct addrinfo *AI = NULL; + IPAddress nul; + + nul.GetAddrInfo(AI, AF_INET6); // IPv6 uses the largest buffers. debugs(5,8, "comm_udp_recvfrom: FD " << fd << " from " << from); - x = recvfrom(fd, buf, len, flags, (struct sockaddr*)&from_addr, &sz); - if(sz == sizeof(sockaddr_in)) - from = *((struct sockaddr_in *)&from_addr); -#if USE_IPV6 - else if(sz == sizeof(sockaddr_in6)) - from = *((struct sockaddr_in6 *)&from_addr); -#endif - else - debugs( 5, 0, "ERROR: comm_udp_recvfrom does not understand the sockaddr* type of : " << from ); + x = recvfrom(fd, buf, len, flags, AI->ai_addr, &AI->ai_addrlen); + + from = *AI; + + nul.FreeAddrInfo(AI); return x; } @@ -791,7 +786,7 @@ // (does assume its a TCP socket) temp.GetAddrInfo(addr); - if (getsockname(fd, (struct sockaddr *)addr->ai_addr, &(addr->ai_addrlen)) ) { + if (getsockname(fd, addr->ai_addr, &(addr->ai_addrlen)) ) { debugs(50, 1, "comm_local_port: Failed to retrieve TCP/UDP port number for socket: FD " << fd << ": " << xstrerror()); temp.FreeAddrInfo(addr); return 0; @@ -1411,7 +1406,7 @@ struct addrinfo *gai = NULL; details.me.GetAddrInfo(gai); - if ((sock = accept(fd, (struct sockaddr *)gai->ai_addr, &gai->ai_addrlen)) < 0) { + if ((sock = accept(fd, gai->ai_addr, &gai->ai_addrlen)) < 0) { details.me.FreeAddrInfo(gai); @@ -1434,7 +1429,7 @@ details.me.SetEmpty(); - getsockname(sock, (struct sockaddr *)gai->ai_addr, &gai->ai_addrlen); + getsockname(sock, gai->ai_addr, &gai->ai_addrlen); commSetCloseOnExec(sock); /* fdstat update */ fd_open(sock, FD_SOCKET, "HTTP Request"); Index: squid3/src/neighbors.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/neighbors.cc,v retrieving revision 1.23.4.21 retrieving revision 1.23.4.22 diff -u -r1.23.4.21 -r1.23.4.22 --- squid3/src/neighbors.cc 3 Jun 2007 12:14:48 -0000 1.23.4.21 +++ squid3/src/neighbors.cc 3 Jun 2007 12:58:32 -0000 1.23.4.22 @@ -1,6 +1,6 @@ /* - * $Id: neighbors.cc,v 1.23.4.21 2007/06/03 12:14:48 amosjeffries Exp $ + * $Id: neighbors.cc,v 1.23.4.22 2007/06/03 12:58:32 amosjeffries Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -1192,11 +1192,9 @@ int neighborUp(const peer * p) { - debugs(15, 3, "neighborUp: Testing UP/DOWN status of " << p->host << " (" << p->in_addr << ") "); if (!p->tcp_up) { - debugs(15, 3, "neighborUp: DOWN (probing): " << p->host << " (" << p->in_addr << ")"); if (!peerProbeConnect((peer *) p)) { - debugs(15, 3, "neighborUp: DOWN (probed): " << p->host << " (" << p->in_addr << ")"); + debugs(15, 8, "neighborUp: DOWN (probed): " << p->host << " (" << p->in_addr << ")"); return 0; } } @@ -1206,22 +1204,22 @@ * for it. */ if (0 == p->n_addresses) { - debugs(15, 3, "neighborUp: DOWN (no-ip): " << p->host << " (" << p->in_addr << ")"); + debugs(15, 8, "neighborUp: DOWN (no-ip): " << p->host << " (" << p->in_addr << ")"); return 0; } if (p->options.no_query) { - debugs(15, 3, "neighborUp: UP (no-query): " << p->host << " (" << p->in_addr << ")"); + debugs(15, 8, "neighborUp: UP (no-query): " << p->host << " (" << p->in_addr << ")"); return 1; } if (p->stats.probe_start != 0 && squid_curtime - p->stats.probe_start > Config.Timeout.deadPeer) { - debugs(15, 3, "neighborUp: DOWN (dead): " << p->host << " (" << p->in_addr << ")"); + debugs(15, 8, "neighborUp: DOWN (dead): " << p->host << " (" << p->in_addr << ")"); return 0; } - debugs(15, 3, "neighborUp: UP: " << p->host << " (" << p->in_addr << ")"); + debugs(15, 8, "neighborUp: UP: " << p->host << " (" << p->in_addr << ")"); return 1; }