PHP Warning: filesize(): stat failed
-
Occasionally in PHP log seeing entries similar to this:
[Feb 24, 17:10:48] PHP Warning: filesize(): stat failed for /home/www/wp-content/cache/supercache/www.website.com/somelink/15266319706217ae08386910.65424059.tmp in /home/www/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 2331 [Feb 24, 17:10:48] PHP Warning: filesize(): stat failed for /home/www/wp-content/cache/supercache/www.website.com/somelink/15266319706217ae08386910.65424059.tmp.gz in /home/www/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 2345
Wondering what might be the cause of this? Race condition?
Using Cache Delivery Method: Expert.
-
I don’t think it’s a race condition but the files should have been created before the filesize() check is made. I don’t think it’s anything to worry about but some pages may not be cached on your site, sometimes.
But seeing hundreds of these messages every day?
That is a problem. I’m pretty sure it’s not a problem with the plugin. Has your server been shut down expectantly recently? If it’s a Linux server you might want to run e2fsck on the filesystem to make sure files are created correctly.
There was no unexpected shutdown of the server.
efsck shows file system is clean.
The only non-standard thing on the server is that one of the plugins clears WP Super Cache on request, using the following code:
$cache_dir_path = get_supercache_dir(); prune_super_cache( $cache_dir_path . 'index.html', true ); prune_super_cache( $cache_dir_path . 'index.html.gz', true );
Not sure is that related.
It shouldn’t interfere but if you’re only deleting one file you should probably use unlink() instead:
unlink( $cache_dir_path . 'index.html' ); unlink( $cache_dir_path . 'index.html.gz' );
Not deleting the single page from cache, but need to delete complete cache.
Regarding “filesize(): stat failed” warnings, it seems we are not checking if the file exists before checking its size:
https://stackoverflow.com/a/34753479/5204858Ah, that’s it then. You’re deleting the entire cache right at the same time a cached page is being created. Your cache must be getting destroyed quite often if you see this error regularly.
I’m aware the plugin isn’t checking if the file exists, the warning you’re seeing is happening while we create a new page. There’s no way to get to that code without the temporary cache file existing. Unless of course you’re blowing away the cache on a regular basis in another process. ??
I’ll put an “@” in front of it and suppress the error message. Those cache files aren’t getting created anyway.
This is 24-hour span:
[27-Mar-2022 04:58:44 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 04:58:44 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 06:31:15 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 06:31:15 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 06:34:34 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 06:34:34 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 06:40:32 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 06:40:32 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 07:04:29 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 07:04:29 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 07:04:29 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 07:04:29 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 07:07:13 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 07:07:13 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 07:16:36 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 07:16:36 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 07:34:37 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 07:34:37 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 07:58:29 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 07:58:29 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 08:10:30 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 08:10:30 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 09:05:01 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 09:05:01 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 09:06:02 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 09:06:02 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 09:17:01 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 09:17:01 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 09:28:25 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 09:28:25 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 09:50:22 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 09:50:22 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 09:58:13 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 09:58:13 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 10:16:12 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 10:16:12 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 11:36:02 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 11:36:02 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 12:04:31 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 12:04:31 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 12:13:59 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 12:13:59 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 12:50:55 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 12:50:55 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 13:34:32 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 13:34:32 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 13:35:16 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 13:35:16 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 13:37:17 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 13:37:17 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 14:32:17 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 14:32:17 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 14:58:10 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 14:58:10 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 15:23:03 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 15:23:03 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 15:23:03 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 15:23:03 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 15:40:31 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 15:40:31 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 15:46:39 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 15:46:39 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 15:46:39 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 15:46:39 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 15:46:39 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 15:46:39 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 17:14:01 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 17:14:01 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 17:17:59 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 17:17:59 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 17:44:04 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 17:44:04 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 17:50:14 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 17:50:14 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 18:04:37 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 18:04:37 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 18:42:23 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 18:42:23 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 19:46:42 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 19:46:42 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 21:57:46 UTC] PHP Warning: filesize(): stat failed [27-Mar-2022 21:57:46 UTC] PHP Warning: filesize(): stat failed [28-Mar-2022 02:43:56 UTC] PHP Warning: filesize(): stat failed [28-Mar-2022 02:43:56 UTC] PHP Warning: filesize(): stat failed [28-Mar-2022 04:43:32 UTC] PHP Warning: filesize(): stat failed [28-Mar-2022 04:43:32 UTC] PHP Warning: filesize(): stat failed [28-Mar-2022 04:46:48 UTC] PHP Warning: filesize(): stat failed [28-Mar-2022 04:46:48 UTC] PHP Warning: filesize(): stat failed [28-Mar-2022 04:46:51 UTC] PHP Warning: filesize(): stat failed [28-Mar-2022 04:46:51 UTC] PHP Warning: filesize(): stat failed
Since we do use official prune_super_cache() function to destroy cache, this is actually a race condition ??
In https://github.com/Automattic/wp-super-cache/pull/814 I hid those warnings so you won’t see this message after the next release. Thanks for the report!
Many thanks @donncha
- The topic ‘PHP Warning: filesize(): stat failed’ is closed to new replies.