------------------------------------------------------------ revno: 11736 revision-id: squid3@treenet.co.nz-20121202081717-gtew9hhw71npa6kg parent: squid3@treenet.co.nz-20121202080913-vj2h46slcjneen50 fixes bug(s): http://bugs.squid-cache.org/show_bug.cgi?id=3688 author: Alexander Komyagin , Daniel Beschorner committer: Amos Jeffries branch nick: 3.2 timestamp: Sun 2012-12-02 01:17:17 -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-20121202081717-gtew9hhw71npa6kg # target_branch: http://bzr.squid-cache.org/bzr/squid3/branches\ # /SQUID_3_2 # testament_sha1: 42937ee9244654cdb863ce06d6830bb3633f4a3c # timestamp: 2012-12-02 08:52:53 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/branches\ # /SQUID_3_2 # base_revision_id: squid3@treenet.co.nz-20121202080913-\ # vj2h46slcjneen50 # # Begin patch === modified file 'src/adaptation/icap/Xaction.cc' --- src/adaptation/icap/Xaction.cc 2012-07-27 04:06:32 +0000 +++ src/adaptation/icap/Xaction.cc 2012-12-02 08:17:17 +0000 @@ -42,7 +42,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 @@ -167,7 +168,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); } @@ -222,6 +223,8 @@ // connection with the ICAP service established void Adaptation::Icap::Xaction::noteCommConnected(const CommConnectCbParams &io) { + cs = NULL; + if (io.flag == COMM_TIMEOUT) { handleCommTimedout(); return; @@ -506,6 +509,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-07-27 04:06:32 +0000 +++ src/adaptation/icap/Xaction.h 2012-12-02 08:17:17 +0000 @@ -44,6 +44,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-10 12:14:30 +0000 +++ src/comm/ConnOpener.h 2012-12-02 08:17:17 +0000 @@ -21,6 +21,8 @@ virtual void swanSong(); public: + void noteAbort() { mustStop("externally aborted"); } + typedef CbcPointer Pointer; virtual bool doneAll() const;