New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
4.x ?token query param is cached even if "Query String Caching" is OFF #467
Comments
Cache warmers have been replaced by generators in Blitz 4, which do use tokens for telling Craft that a URL is a generation request, so there's nothing to be concerned about there. You should not have to add an exception for Can you help me understand what the current issue is? Be sure to check the |
Thanks for the reply. This is from queue.log
https://github.com/putyourlightson/craft-blitz/blob/4.2.3/src/services/CacheRequestService.php#L80 |
These timeouts are happening during the cache generation process only. Can you check whether those pages actually load within 10 seconds, which is the max time allowed per generation request. |
Yes, I can load these pages with a token through the browser within 10 seconds (literally takes 1 second), but the page content with token param is empty (as I understand it specically made for cache generators?). |
Hmm, which cache generation driver are you using and with what settings? And is the timeout happening only for the 5 pages shown above, or for more pages? |
Blitz File Storage. HTTP generator(default). Reverse Proxy Purger - None. Do not cache URLs with query strings. No remote deployer. |
Remember, a token is always used in cache generation, so it is failing for those 20-25 pages due to a timeout. What concurrency value is selected under Cache Generation? |
3 concurrent requests. No custom URLs. |
In that case I'm not sure what the issue is. Do you have a CDN or firewall that might be blocking repeated HTTP requests from the server? Perhaps trying the Local Generator might make sense too. |
Thank you very much for the fast replies. I'll try something and let you know. |
Yes, it looks copied directly from the docs, which are correct. |
After some research, I figured out a potential issue that causes my site to go down on cache generation. Maybe I'm wrong, but here's what I found out: Did Gizzly work differently? Gizzly waited for a 200 server response or timeout, but never dropped the connection himself after certain time like it works with the amphp? |
You're right that the new HTTP Generator, which uses AMPHP, uses a timeout of 10 seconds, whereas the old Guzzle Warmer did not enforce a timeout. I could make the value configurable, but it seems wise to set a timeout. Your server should enforce its own timeout (via the A few things you could try are:
|
Thank you for the detailed answer! |
If some pages are taking over 10 seconds to respond then it sounds like there might be opportunities for optimising using eager-loading. Be sure to check out the Blitz Hints utility if you haven't yet. The Local Generator uses PHP processes to mock requests rather than making external HTTP requests. I imagine it might solve your issues. |
@bencroker In any case, I really appreciate your help, thanks again. |
I added a return [
'*' => [
// The generator settings.
'cacheGeneratorSettings' => [
'concurrency' => 3,
// Override the default value of 10000 milliseconds
'timeout' => 30000,
],
],
]; |
FYI I set the new default timeout to 120 seconds, which is the minimum PHP max execution time that Craft requires. |
Make sense, thanks! |
Just released in version 4.3.0. |
Should this feature be documented in the default configuration file? Line 75 in e464f25
|
@holmey not necessarily, as the value here is meant as an example rather than documentation, and it is unlikely that the majority of people will ever have to change it. |
After updating a number of sites to craft 4.x, I noticed a problem that while job on warming up the cache, the job itself constantly fails and starts again
I canceled the job and tried to warmup the cache through the CLI
In the logs(log file from the blitz) after the warming is done, I noticed that pages with a token parameter (
?token=XXXXX
) appeared in the log file, while the cache warming up for query params was turned off[2023-01-30 23:33:43] Inactivity timeout exceeded, more than 10000 ms elapsed from last data received [https://site.com/myurl?token=Eni7rmSnSoLVranG3QVgx3ftG9tCyy-A]
Enabling query string caching and adding a
?token
to the exception solves the problem, but I would like to understand why this happens at allI checked the database, there is no URL with this parameter in the blitz cache and site elements tables. As far as I understand, these pages come from craft(I mean token param itself), I don’t fully understand what this token does.
Maybe it's somehow related to craftcms/cms#12458 / craftcms/cms#5698 ?
PHP 8.1.14
Craft Pro 4.3.5
Blitz 4.2.3
The text was updated successfully, but these errors were encountered: