Describe the bug
The customer's debug log file is filled with PHP Warnings for _temp file extensions not found after updating to 3.5.0.3 and only on the 1st preload. Here's the log they shared:
[13-Mar-2020 08:29:55 UTC] PHP Warning: copy(/home/****/wp-content/cache/wp-rocket/www.0creditcardexpert.co.uk/0-credit-card-abroad/index-https.html_gzip_temp): failed to open stream: No such file or directory in /home/****/wp-admin/includes/class-wp-filesystem-direct.php on line 281
[13-Mar-2020 08:30:09 UTC] PHP Warning: chmod(): No such file or directory in /home/****/wp-admin/includes/class-wp-filesystem-direct.php on line 168
[13-Mar-2020 08:30:09 UTC] PHP Warning: copy(/home/****/wp-content/cache/wp-rocket/www.0creditcardexpert.co.uk/credit-card-minimum-payment/index-mobile-https.html_gzip_temp): failed to open stream: No such file or directory in /home/****/wp-admin/includes/class-wp-filesystem-direct.php on line 281
[13-Mar-2020 08:30:10 UTC] PHP Warning: copy(/home/****/wp-content/cache/wp-rocket/www.0creditcardexpert.co.uk/0-credit-card-abroad/index-mobile-https.html_gzip_temp): failed to open stream: No such file or directory in /home/****/wp-admin/includes/class-wp-filesystem-direct.php on line 281
[13-Mar-2020 08:30:21 UTC] PHP Warning: copy(/home/****/wp-content/cache/wp-rocket/www.0creditcardexpert.co.uk/about/index-mobile-https.html_gzip_temp): failed to open stream: No such file or directory in /home/****/wp-admin/includes/class-wp-filesystem-direct.php on line 281
[13-Mar-2020 08:30:38 UTC] PHP Warning: copy(/home/****/wp-content/cache/wp-rocket/www.0creditcardexpert.co.uk/press/index-mobile-https.html_temp): failed to open stream: No such file or directory in /home/****/wp-admin/includes/class-wp-filesystem-direct.php on line 281
[13-Mar-2020 08:30:41 UTC] PHP Warning: chmod(): No such file or directory in /home/****/wp-admin/includes/class-wp-filesystem-direct.php on line 168
[13-Mar-2020 08:30:41 UTC] PHP Warning: copy(/home/****/wp-content/cache/wp-rocket/www.0creditcardexpert.co.uk/privacy-policy/index-mobile-https.html_temp): failed to open stream: No such file or directory in /home/****/wp-admin/includes/class-wp-filesystem-direct.php on line 281
[13-Mar-2020 08:30:43 UTC] PHP Warning: chmod(): No such file or directory in /home/****/wp-admin/includes/class-wp-filesystem-direct.php on line 168
[13-Mar-2020 08:30:43 UTC] PHP Warning: copy(/home/****/wp-content/cache/wp-rocket/www.0creditcardexpert.co.uk/resources/index-mobile-https.html_temp): failed to open stream: No such file or directory in /home/****/wp-admin/includes/class-wp-filesystem-direct.php on line 281
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Update and generate preload without PHP warnings.
Additional context
Backlog Grooming
I am not able to reproduce, but I got PHP notices instead. I'm opening a new issue related to those.
@hellofromtonya Should we contact this person to try to reproduce on their site?
@Screenfeed The steps that I laid out _might not be_ exact to what the customer did. He noted that it happened during update and 1st preload.
Could you try to reproduce it in different combinations of update and 1st preload?
It didn't happen for them again when updating to 3.5.0.4. What do you think might be contributing to such a problem?
Reproduce the problem ✅
This is not related to the update process, but happens when caching.
Identify the root cause ✅
This happens if the /wp-content/cache/wp-rocket/’s child folder is not writable. Here, it would be /wp-content/cache/wp-rocket/www.0creditcardexpert.co.uk/.
Scope a solution ✅
Add some tests like is_writable() in WP_Rocket\Buffer\Cache->maybe_process_buffer() and WP_Rocket\Buffer\Cache->write_cache_file().
Estimate the effort ✅
effort: [S]
@Screenfeed
@hellofromtonya
Actually none of this makes sense to me, but I have no other explanations.
the site was in the middle of a caching process when the update triggered, leaving opened files/folders in an "intermediate" state. Then the upgrade from 3.4.4 to 3.5.0.3 doesn’t include a cache refresh
That's a good theory. @Screenfeed test it by:
@crystinutzaa @Tabrisrp I am not able to reproduce my hypothesis in my last message.
Do you have other ideas and/or are you able to reproduce?
Another related ticket: https://secure.helpscout.net/conversation/1127829424/155708?folderId=273761
I was able to recreate this issue on my local.
The issue is that Partial Preload is running during upgrade.
This is the full stacktrace:
[06-Apr-2020 13:01:57 UTC] PHP Warning: copy(/app/public/wp-content/cache/wp-rocket/wp3.local/index.html_temp): failed to open stream: No such file or directory in /app/public/wp-admin/includes/class-wp-filesystem-direct.php on line 281
[06-Apr-2020 13:01:57 UTC] PHP Stack trace:
[06-Apr-2020 13:01:57 UTC] PHP 1. shutdown_action_hook() /app/public/wp-includes/load.php:0
[06-Apr-2020 13:01:57 UTC] PHP 2. do_action() /app/public/wp-includes/load.php:947
[06-Apr-2020 13:01:57 UTC] PHP 3. WP_Hook->do_action() /app/public/wp-includes/plugin.php:478
[06-Apr-2020 13:01:57 UTC] PHP 4. WP_Hook->apply_filters() /app/public/wp-includes/class-wp-hook.php:312
[06-Apr-2020 13:01:57 UTC] PHP 5. wp_ob_end_flush_all() /app/public/wp-includes/class-wp-hook.php:288
[06-Apr-2020 13:01:57 UTC] PHP 6. ob_end_flush() /app/public/wp-includes/functions.php:4552
[06-Apr-2020 13:01:57 UTC] PHP 7. WP_Rocket\Buffer\Cache->maybe_process_buffer() /app/public/wp-includes/functions.php:4552
[06-Apr-2020 13:01:57 UTC] PHP 8. WP_Rocket\Buffer\Cache->write_cache_file() /app/public/wp-content/plugins/wp-rocket/inc/classes/Buffer/class-cache.php:308
[06-Apr-2020 13:01:57 UTC] PHP 9. WP_Filesystem_Direct->move() /app/public/wp-content/plugins/wp-rocket/inc/classes/Buffer/class-cache.php:352
[06-Apr-2020 13:01:57 UTC] PHP 10. WP_Filesystem_Direct->copy() /app/public/wp-admin/includes/class-wp-filesystem-direct.php:309
[06-Apr-2020 13:01:57 UTC] PHP 11. copy() /app/public/wp-admin/includes/class-wp-filesystem-direct.php:281
In this file the error occurs:
https://github.com/wp-media/wp-rocket/blob/00cf7a1c5e0b2e7354b0aa76ca86603ee4420eae/inc/classes/Buffer/class-cache.php#L341-L352
This is triggered by Partial Preload on maybe dispatch.
What I assume is happening is:
The solution is:
Stop Preloading / Partial Preloading during upgrading WP Rocket.
@Tabrisrp , @Screenfeed & @hellofromtonya
I cannot estimate how much effort this will take. 😄 Ideas?
Should this estimation be with the new Upgrading system we discussed today?
Customer to follow up when fixed:
Related ticket: https://secure.helpscout.net/conversation/1162724289/164680/
This issue will be fixed in a future major release. It's blocked until the new Preload is built.
Related tickets:
https://secure.helpscout.net/conversation/1231270616/181548 (requested a refund)
WIP: https://secure.helpscout.net/conversation/1228142197/180871 (asked for credentials)
WIP: https://secure.helpscout.net/conversation/1232604979/181835 (asked for credentials)
When is the fix going to be released ? This seems to be related https://github.com/wp-media/wp-rocket/issues/3314
When is the fix going to be released ?
@mzimma We are planning to re-write our entire preload approach (no ETA yet). This will be fixed during the rewrite.
Sounds good, thank you!
Related ticket: https://secure.helpscout.net/conversation/1347367935/215413/
Most helpful comment
I am not able to reproduce, but I got PHP notices instead. I'm opening a new issue related to those.