Skip to content
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

Full static cache randomly misses cache hit #6990

Closed
ahinkle opened this issue Nov 2, 2022 · 4 comments
Closed

Full static cache randomly misses cache hit #6990

ahinkle opened this issue Nov 2, 2022 · 4 comments

Comments

@ahinkle
Copy link
Contributor

ahinkle commented Nov 2, 2022

Bug description

Hey folks 👋

I'm having an issue with the full-page cache. I've read through the documentation, asked on Discord, and researched online, and the issue persists.

Most of the time the caching works, and randomly at different points throughout the day, it will stop working for random expected cached pages. I will see in my error log:

Static cache loaded [https://(domain).com/] If you are seeing this, your server rewrite rules have not been set up correctly.

This site has high traffic, and it happens sometimes but not all the time and at random intervals (nothing during deployment).

How to reproduce

  1. Enable Full Page Cache (env: STATAMIC_STATIC_CACHING_STRATEGY="full")
  2. Set config for static page cache:

Static Cache Strategies:

        'full' => [
            'driver' => 'file',
            'path' => public_path('static'),
            'lock_hold_length' => 0,
            'warm_concurrency' => 10,
        ],

Static Cache Excludes:

    'exclude' => [
        '/sitemap.xml',
    ],

Statatic Cache Ignore Query Strings:

 'ignore_query_strings' => true,
  1. Update NGINX Config:
    location / {
        try_files /static${uri}_${args}.html $uri /index.php?$args;
    }
  1. Update Forge Deployment Script:
if [[ $FORGE_DEPLOY_MESSAGE =~ "[Autosave]" ]]; then
    echo "Automatically committed on production. Nothing to deploy."
    exit 0
fi

( flock -w 10 9 || exit 1
    echo 'Restarting FPM...'; sudo -S service $FORGE_PHP_FPM reload ) 9>/tmp/fpmlock

cd /home/forge/(domain).com
git pull origin $FORGE_SITE_BRANCH
$FORGE_COMPOSER install --no-interaction --prefer-dist --optimize-autoloader

npm ci
npm run build
$FORGE_PHP artisan cache:clear
$FORGE_PHP artisan config:cache
$FORGE_PHP artisan route:cache
$FORGE_PHP artisan ratings:refresh
$FORGE_PHP artisan queue:restart
$FORGE_PHP artisan statamic:search:update --all
$FORGE_PHP artisan statamic:static:clear
$FORGE_PHP artisan statamic:assets:generate-presets --queue
$FORGE_PHP artisan statamic:static:warm

Logs

Static cache loaded [https://(domain).com/premium-features] If you are seeing this, your server rewrite rules have not been set up correctly.

Static cache loaded [https://(domain).com/] If you are seeing this, your server rewrite rules have not been set up correctly.

Static cache loaded [https://(domain).com/blog] If you are seeing this, your server rewrite rules have not been set up correctly.

Environment

Environment
Application Name: (redacted)
Laravel Version: 9.38.0
PHP Version: 8.1.8
Composer Version: 2.4.4
Environment: production
Debug Mode: OFF
URL: (redacted).com
Maintenance Mode: OFF

Cache
Config: CACHED
Events: NOT CACHED
Routes: CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: redis
Database: mysql
Logs: production / single, slack
Mail: ses
Queue: sync
Session: file

Statamic
Addons: 1
Antlers: regex
Version: 3.3.50 PRO

Statamic Addons
optimoapps/statamic-bard-text-align: 1.0.2

Someone recommended turning off OpCache; this is disabled, and the issue still persists.

Installation

Fresh statamic/statamic site via CLI

Antlers Parser

No response

Additional details

No response

@ilicmarko
Copy link

Any updates? Because #3255 has been resolved but still seeing the same issue.

@ahinkle
Copy link
Contributor Author

ahinkle commented Aug 23, 2023

Yeah, that PR was some time ago. I'm still experiencing this issue, unfortunately.

@jasonvarga
Copy link
Member

If you can provide a reproducible example, that'd be very helpful in tracking this down.

Perhaps there's a race condition where someone hits the page at the same time as the cache file is being generated.

Are the logs appearing when someone is making changes in the CP?

@duncanmcclean
Copy link
Member

There hasn't been any comments on this issue in a while - none since the last comment requesting more information (reproduction repo / logs).

There seems to be a newer, more active issue about the same error (#8860) so I'm going to close this issue in favour of that one. Feel free to provide additional info on that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants