From: wessels <> Date: Tue, 10 Jan 2006 03:38:44 +0000 (+0000) Subject: Added some timeout debugging for ICAP transactions. Since ICAPXaction X-Git-Tag: SQUID_3_0_PRE4~380 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3cfc19b33499af57383e28bdf58f1acc272f41e4;p=thirdparty%2Fsquid.git Added some timeout debugging for ICAP transactions. Since ICAPXaction doesn't know anything about its derived classes, also added a HttpMsg::firstLineBuf() method to be used in the debugging of timeouts. --- diff --git a/src/HttpMsg.cc b/src/HttpMsg.cc index 53b9e00514..b9112b4a54 100644 --- a/src/HttpMsg.cc +++ b/src/HttpMsg.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpMsg.cc,v 1.22 2005/12/29 18:04:41 wessels Exp $ + * $Id: HttpMsg.cc,v 1.23 2006/01/09 20:38:44 wessels Exp $ * * DEBUG: section 74 HTTP Message * AUTHOR: Alex Rousskov @@ -343,3 +343,14 @@ void HttpMsg::hdrCacheInit() assert(NULL == cache_control); cache_control = httpHeaderGetCc(&header); } + +/* + * useful for debugging + */ +void HttpMsg::firstLineBuf(MemBuf& mb) +{ + Packer p; + packerToMemInit(&p, &mb); + packFirstLineInto(&p, true); + packerClean(&p); +} diff --git a/src/HttpMsg.h b/src/HttpMsg.h index 893c5deec2..3fdd7a9d87 100644 --- a/src/HttpMsg.h +++ b/src/HttpMsg.h @@ -1,6 +1,6 @@ /* - * $Id: HttpMsg.h,v 1.5 2005/11/21 23:02:37 wessels Exp $ + * $Id: HttpMsg.h,v 1.6 2006/01/09 20:38:44 wessels Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -81,6 +81,10 @@ protected: virtual void packFirstLineInto(Packer * p, bool full_uri) const = 0; virtual bool parseFirstLine(const char *blk_start, const char *blk_end) = 0; virtual void hdrCacheInit(); + +public: + + void firstLineBuf(MemBuf&); }; diff --git a/src/ICAP/ICAPModXact.cc b/src/ICAP/ICAPModXact.cc index 51189b7b34..87c6f5dc57 100644 --- a/src/ICAP/ICAPModXact.cc +++ b/src/ICAP/ICAPModXact.cc @@ -1272,3 +1272,18 @@ void ICAPPreview::wrote(size_t size, bool sawEof) theState = stIeof; } +bool ICAPModXact::fillVirginHttpHeader(MemBuf &mb) const +{ + if (virgin == NULL) + return false; + + if (virgin->data == NULL) + return false; + + if (virgin->data->header == NULL) + return false; + + virgin->data->header->firstLineBuf(mb); + + return true; +} diff --git a/src/ICAP/ICAPModXact.h b/src/ICAP/ICAPModXact.h index ad62c85f8e..6873883ad3 100644 --- a/src/ICAP/ICAPModXact.h +++ b/src/ICAP/ICAPModXact.h @@ -1,6 +1,6 @@ /* - * $Id: ICAPModXact.h,v 1.4 2005/12/22 23:09:09 wessels Exp $ + * $Id: ICAPModXact.h,v 1.5 2006/01/09 20:38:44 wessels Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -212,6 +212,7 @@ private: virtual void fillPendingStatus(MemBuf &buf) const; virtual void fillDoneStatus(MemBuf &buf) const; + virtual bool fillVirginHttpHeader(MemBuf&) const; private: void packHead(MemBuf &httpBuf, const HttpMsg *head); diff --git a/src/ICAP/ICAPXaction.cc b/src/ICAP/ICAPXaction.cc index 826aa25b03..5161246db9 100644 --- a/src/ICAP/ICAPXaction.cc +++ b/src/ICAP/ICAPXaction.cc @@ -179,6 +179,7 @@ void ICAPXaction::scheduleWrite(MemBuf &buf) writer = &ICAPXaction_noteCommWrote; comm_old_write_mbuf(connection, &buf, writer, this); fd_table[connection].noteUse(icapPconnPool); + commSetTimeout(connection, 61, &ICAPXaction_noteCommTimedout, this); } void ICAPXaction::noteCommWrote(comm_err_t commStatus, size_t size) @@ -207,6 +208,14 @@ void ICAPXaction::noteCommTimedout() void ICAPXaction::handleCommTimedout() { + debugs(93, 0, HERE << "ICAP FD " << connection << " timeout to " << theService->methodStr() << " " << theService->uri.buf()); + MemBuf mb; + mb.init(); + + if (fillVirginHttpHeader(mb)) { + debugs(93, 0, HERE << "\tfor " << mb.content()); + } + mustStop("connection with ICAP service timed out"); } @@ -252,6 +261,7 @@ void ICAPXaction::scheduleRead() */ comm_read(connection, commBuf, readBuf.spaceSize(), reader, this); + commSetTimeout(connection, 61, &ICAPXaction_noteCommTimedout, this); } // comm module read a portion of the ICAP response for us @@ -437,3 +447,8 @@ void ICAPXaction::fillDoneStatus(MemBuf &buf) const if (stopReason != NULL) buf.Printf("Stopped"); } + +bool ICAPXaction::fillVirginHttpHeader(MemBuf &buf) const +{ + return false; +} diff --git a/src/ICAP/ICAPXaction.h b/src/ICAP/ICAPXaction.h index a4646662b1..b43c5ab2b3 100644 --- a/src/ICAP/ICAPXaction.h +++ b/src/ICAP/ICAPXaction.h @@ -1,6 +1,6 @@ /* - * $Id: ICAPXaction.h,v 1.5 2005/12/22 23:40:26 wessels Exp $ + * $Id: ICAPXaction.h,v 1.6 2006/01/09 20:38:44 wessels Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -97,6 +97,9 @@ protected: virtual void fillPendingStatus(MemBuf &buf) const; virtual void fillDoneStatus(MemBuf &buf) const; + // useful for debugging + virtual bool fillVirginHttpHeader(MemBuf&) const; + protected: int connection; // FD of the ICAP server connection