------------------------------------------------------------ revno: 12423 revision-id: squid3@treenet.co.nz-20121202072740-u3655eueyi40yorw parent: squid3@treenet.co.nz-20121202072627-nujvm0jmim11eivs fixes bug(s): http://bugs.squid-cache.org/show_bug.cgi?id=3688 author: Alexander Komyagin , Daniel Beschorner committer: Amos Jeffries branch nick: 3.3 timestamp: Sun 2012-12-02 00:27:40 -0700 message: Bug 3688: Lots of Orphan Comm:Connections to ICAP server ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20121202072740-u3655eueyi40yorw # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # testament_sha1: b9ef7ef4205505a811270c5bfeed9405f447aeea # timestamp: 2012-12-02 07:27:55 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # base_revision_id: squid3@treenet.co.nz-20121202072627-\ # nujvm0jmim11eivs # # Begin patch === modified file 'src/adaptation/icap/Xaction.cc' --- src/adaptation/icap/Xaction.cc 2012-09-04 09:10:20 +0000 +++ src/adaptation/icap/Xaction.cc 2012-12-02 07:27:40 +0000 @@ -45,7 +45,8 @@ ignoreLastWrite(false), connector(NULL), reader(NULL), writer(NULL), closer(NULL), alep(new AccessLogEntry), - al(*alep) + al(*alep), + cs(NULL) { debugs(93,3, typeName << " constructed, this=" << this << " [icapx" << id << ']'); // we should not call virtual status() here @@ -170,7 +171,7 @@ // TODO: service bypass status may differ from that of a transaction typedef CommCbMemFunT ConnectDialer; connector = JobCallback(93,3, ConnectDialer, this, Adaptation::Icap::Xaction::noteCommConnected); - Comm::ConnOpener *cs = new Comm::ConnOpener(connection, connector, TheConfig.connect_timeout(service().cfg().bypass)); + cs = new Comm::ConnOpener(connection, connector, TheConfig.connect_timeout(service().cfg().bypass)); cs->setHost(s.cfg().host.termedBuf()); AsyncJob::Start(cs); } @@ -225,6 +226,8 @@ // connection with the ICAP service established void Adaptation::Icap::Xaction::noteCommConnected(const CommConnectCbParams &io) { + cs = NULL; + if (io.flag == COMM_TIMEOUT) { handleCommTimedout(); return; @@ -508,6 +511,12 @@ void Adaptation::Icap::Xaction::swanSong() { // kids should sing first and then call the parent method. + if (cs) { + debugs(93,6, HERE << id << " about to notify ConnOpener!"); + CallJobHere(93, 3, cs, Comm::ConnOpener, noteAbort); + cs = NULL; + service().noteConnectionFailed("abort"); + } closeConnection(); // TODO: rename because we do not always close === modified file 'src/adaptation/icap/Xaction.h' --- src/adaptation/icap/Xaction.h 2012-09-01 14:38:36 +0000 +++ src/adaptation/icap/Xaction.h 2012-12-02 07:27:40 +0000 @@ -42,6 +42,10 @@ #include "ipcache.h" class CommConnectCbParams; +namespace Comm +{ +class ConnOpener; +} namespace Adaptation { @@ -188,6 +192,7 @@ timeval icap_tio_finish; /*time when the last byte of the ICAP responsewas received*/ private: + Comm::ConnOpener *cs; //CBDATA_CLASS2(Xaction); }; === modified file 'src/comm/ConnOpener.h' --- src/comm/ConnOpener.h 2012-04-03 11:06:14 +0000 +++ src/comm/ConnOpener.h 2012-12-02 07:27:40 +0000 @@ -21,6 +21,8 @@ virtual void swanSong(); public: + void noteAbort() { mustStop("externally aborted"); } + typedef CbcPointer Pointer; virtual bool doneAll() const;