From 501b58f95c010772a0df5176b1e1821ed3bd19be Mon Sep 17 00:00:00 2001 From: serassio <> Date: Sun, 2 Apr 2006 17:58:38 +0000 Subject: [PATCH] Bug #1491: clientLifetime exceeded + external acl = assertion failure: !asyncInProgress() in ~ACLChecklist This patch allow an ACLList destroy itself after check is complete. If there is asyncInProgress() when the request is being destroyed, then let acl checklist destroy it self once the check is done. Patch provided by Gonzalo Arana. --- src/ACLChecklist.cc | 14 +++++++++++++- src/ACLChecklist.h | 4 +++- src/client_side_request.cc | 11 ++++++++--- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/ACLChecklist.cc b/src/ACLChecklist.cc index 940c41ecbc..6eeb87512a 100644 --- a/src/ACLChecklist.cc +++ b/src/ACLChecklist.cc @@ -1,5 +1,5 @@ /* - * $Id: ACLChecklist.cc,v 1.31 2006/02/18 00:23:43 wessels Exp $ + * $Id: ACLChecklist.cc,v 1.32 2006/04/02 11:58:38 serassio Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -180,6 +180,12 @@ ACLChecklist::asyncInProgress(bool const newAsync) debug (28,3)("ACLChecklist::asyncInProgress: %p async set to %d\n", this, async_); } +void +ACLChecklist::markDeleteWhenDone() +{ + deleteWhenDone = true; +} + bool ACLChecklist::finished() const { @@ -261,7 +267,12 @@ ACLChecklist::matchAclList(const acl_list * head, bool const fast) if (!nodeMatched || state_ != NullState::Instance()) { debug(28, 3) ("aclmatchAclList: %p returning false (AND list entry failed to match)\n", this); checkForAsync(); + + if (deleteWhenDone && !asyncInProgress()) + delete this; + PROF_stop(aclMatchAclList); + return; } @@ -303,6 +314,7 @@ ACLChecklist::ACLChecklist() : accessList (NULL), my_port (0), request (NULL), conn_(NULL), async_(false), finished_(false), + deleteWhenDone(false), allow_(ACCESS_DENIED), state_(NullState::Instance()), destinationDomainChecked_(false), diff --git a/src/ACLChecklist.h b/src/ACLChecklist.h index 7583fdbfb4..0e4d4c4704 100644 --- a/src/ACLChecklist.h +++ b/src/ACLChecklist.h @@ -1,6 +1,6 @@ /* - * $Id: ACLChecklist.h,v 1.21 2005/04/30 19:32:01 serassio Exp $ + * $Id: ACLChecklist.h,v 1.22 2006/04/02 11:58:38 serassio Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -104,6 +104,7 @@ class NullState : public AsyncState bool asyncInProgress() const; void asyncInProgress(bool const); + void markDeleteWhenDone(); bool finished() const; void markFinished(); void check(); @@ -146,6 +147,7 @@ private: ConnStateData::Pointer conn_; /* hack for ident and NTLM */ bool async_; bool finished_; + bool deleteWhenDone; allow_t allow_; AsyncState *state_; bool destinationDomainChecked_; diff --git a/src/client_side_request.cc b/src/client_side_request.cc index 472e42e508..9464f5ba31 100644 --- a/src/client_side_request.cc +++ b/src/client_side_request.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side_request.cc,v 1.59 2006/03/02 22:47:07 wessels Exp $ + * $Id: client_side_request.cc,v 1.60 2006/04/02 11:58:38 serassio Exp $ * * DEBUG: section 85 Client-side Request Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -110,8 +110,13 @@ ClientRequestContext::~ClientRequestContext() if (http) cbdataReferenceDone(http); - if (acl_checklist) - delete acl_checklist; + if (acl_checklist) { + if (acl_checklist->asyncInProgress()) { + acl_checklist->markDeleteWhenDone(); + } else { + delete acl_checklist; + } + } } ClientRequestContext::ClientRequestContext(ClientHttpRequest *anHttp) : http(anHttp), acl_checklist (NULL), redirect_state (REDIRECT_NONE) -- 2.47.3