[squid-users] Squid BUG: assurance failed: tok.skip(WellKnownUrlPathPrefix())

Alex Rousskov rousskov at measurement-factory.com
Wed Sep 13 18:53:07 UTC 2023


On 2023-09-12 15:50, Loučanský Lukáš wrote:

> 2023/09/12 19:12:03 kid4| ERROR: Squid BUG: assurance failed: 
> tok.skip(WellKnownUrlPathPrefix())

> Request:
> GET cache_object://squid_ip/info HTTP/1.0
> Host: squid_ip
> User-Agent: squidclient/4.6
> Accept: */*
> Connection: close

Thank you for sharing this detail. I can now reproduce this problem.

You are suffering from a bug in Squid v6.3 commit 6695897 (which was 
incorrectly attributed to me). Until that bug is addressed, cache 
manager requests using the deprecated cache_object scheme (e.g., those 
emitted by older squidclients) will trigger the above 
WellKnownUrlPathPrefix assertion in Squid v6.3.

I have attached a patch that fixes this v6.3 bug in my tests.


> Sending HTTP request ...
> done.
> HTTP/1.1 404 Not Found
> Server: squid
> Mime-Version: 1.0
> Date: Tue, 12 Sep 2023 19:09:41 GMT
> Content-Type: text/html;charset=utf-8
> Content-Length: 13057
> X-Squid-Error: ERR_INVALID_URL 0
> Cache-Status: proxy;detail=no-cache
> Via: 1.1 proxy (squid)
> Connection: close
> 
> This is obviously calling for url cache_object://squid_ip/info which I 
> think is obsolete. Now I went with the new squidclient:
> 
> ./squidclient -h squid_ip -p squid_port -vv mgr:info
> 
> Request:
> GET http://squid_ip:squid_port/squid-internal-mgr/info HTTP/1.0
> Host: 10.50.1.5:3127
> User-Agent: squidclient/6.3
> Accept: */*
> Connection: close

> But it seems squid is then trying to open it's 
> visible_hostname:squid_port/squid-internal-mgr/ and due my DNS setting 
> it is its WAN IP - so it's connecting to its outside IP with its outside 
> IP which is not in the http_access manager allow list (now it is and the 
> newer squidclient works).

You are in Squid Bug 5283 territory here:
https://bugs.squid-cache.org/show_bug.cgi?id=5283

In a Linux test environment, I can work around those "outside IP" 
problems by adding "-l 127.0.0.1" option to squidclient, forcing 
squidclient to connect to Squid from the loopback address. IIRC, that 
"-l" trick does not work in environments that do not support 
from-localhost connections to "outside IPs" on the same box (e.g., Windows).


HTH,

Alex.



> -----Původní zpráva-----
> Od: squid-users za uživatele Alex Rousskov
> Odesláno: út 12.9.2023 19:28
> Komu: squid-users at lists.squid-cache.org
> Předmět: Re: [squid-users] Squid BUG: assurance failed: 
> tok.skip(WellKnownUrlPathPrefix())
> 
> On 2023-09-12 13:06, Loučanský Lukáš wrote:
>  > Is this anyhow interesting?
> 
> Not really, IMO -- the problem happens earlier. I can confirm that you
> are running v6.3-based code. Let's call that progress :-).
> 
> Can you share the a _pointer_ to a compressed ALL,9 cache.log file while
> reproducing the problem using a single transaction?
> 
> https://wiki.squid-cache.org/SquidFaq/BugReporting#debugging-a-single-transaction <https://wiki.squid-cache.org/SquidFaq/BugReporting#debugging-a-single-transaction>
> 
> Alex.
> 
>  >
>  > 2023/09/12 18:47:04.267 kid4| 24,8| SBuf.cc(30) SBuf: SBuf15514952 
> created
>  > 2023/09/12 18:47:04.267 kid4| 24,8| SBuf.cc(30) SBuf: SBuf15514953 
> created
>  > 2023/09/12 18:47:04.267 kid4| 24,8| SBuf.cc(30) SBuf: SBuf15514954 
> created
>  > 2023/09/12 18:47:04.267 kid4| 24,7| SBuf.cc(85) assign: assigning
>  > SBuf15514952 from SBuf15514912
>  > 2023/09/12 18:47:04.267 kid4| 24,8| SBuf.cc(38) SBuf: SBuf15514955
>  > created from id SBuf15514915
>  > 2023/09/12 18:47:04.267 kid4| 24,8| SBuf.cc(445) startsWith:
>  > SBuf15514955 startsWith SBuf125812, caseSensitive: 0
>  > 2023/09/12 18:47:04.267 kid4| 24,8| SBuf.cc(447) startsWith: no, too 
> short
>  > 2023/09/12 18:47:04.267 kid4| 24,8| Tokenizer.cc(185) skip: no match,
>  > not skipping '/squid-internal-mgr/'
>  > 2023/09/12 18:47:04 kid4| ERROR: Squid BUG: assurance failed:
>  > tok.skip(WellKnownUrlPathPrefix())
>  > 2023/09/12 18:47:04.268 kid4| 24,8| SBuf.cc(70) ~SBuf: SBuf15514955
>  > destructed
>  >
>  >
>  > BTW debug 24,9 makes pretty big log files... :-)
>  >
>  > L
>  >
> 
> 
> _______________________________________________
> squid-users mailing list
> squid-users at lists.squid-cache.org
> https://lists.squid-cache.org/listinfo/squid-users
-------------- next part --------------
Restore support for legacy cache_object cache manager requests

Squid v6.3 commit 6695897 (i.e. a backport of master/v7 commit 3c383cc)
accidentally removed support of legacy cache_object URLs (that master/v7
does not support) from Squid v6. This fix restores that support in v6.

diff --git a/src/cache_manager.cc b/src/cache_manager.cc
index bb70216..dbb99d9 100644
--- a/src/cache_manager.cc
+++ b/src/cache_manager.cc
@@ -189,9 +189,9 @@ Mgr::Command::Pointer
 CacheManager::ParseUrl(const AnyP::Uri &uri)
 {
     Parser::Tokenizer tok(uri.path());
 
-    Assure(tok.skip(WellKnownUrlPathPrefix()));
+    Assure(tok.skip(WellKnownUrlPathPrefix()) || tok.skip('/'));
 
     Mgr::Command::Pointer cmd = new Mgr::Command();
     cmd->params.httpUri = SBufToString(uri.absolute());
 


More information about the squid-users mailing list