-
Notifications
You must be signed in to change notification settings - Fork 17
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
Temp Files in Cache Directory Fail to Clear #397
Comments
Thanks! Just wanted to clarify that errors like these were present both before and after cache locking. The recent cache locking improvements were aimed at resolving this issue. I'm seeing this issue occur randomly two or three times each week. Looking over the codebase it would seem impossible, and thus I'm guessing at this point that it's still due to some corruption in the stat cache on some versions of PHP. A possible workaround for this might include being more aggressive with That said; I'm curious to know if anyone else reporting this problem is still seeing a large number of these errors in a log file; i.e. more than a few times daily? For instance, in the previous issue (#288) it would seem that our latest |
Right, sorry. I should have said that temp files getting left behind have been ongoing since implementing cache locking, since before cache locking we did not have any temp directories. Also, this issue (prior to cache locking) only exhibited itself rarely, on very large and busy sites. Cache locking (with the new creation and renaming of temp directories) seems to have exasperated the issue (for a yet unknown reason), so more users are now experiencing an issue that previously was only experienced by very large and busy sites. |
I'm sorry to say that i have also found today some tmp leftovers in the "cache/http" directory. I'm running LiteSpeed, Cloudlinux, php 5.5.20 and the server is pretty stable. I guess this is a plugin problem and has not been resolved yet. |
Referencing this block of code. The line with /** @var $_file_dir \RecursiveDirectoryIterator Regex iterator reference for IDEs. */
foreach(($_dir_regex_iteration = $this->dir_regex_iteration($_host_cache_dir_tmp, $_host_cache_dir_tmp_regex)) as $_file_dir)
{
if(($_file_dir->isFile() || $_file_dir->isLink()) // Files and/or symlinks only.
// Don't delete files in the immediate directory; e.g. `zc-advanced-cache` or `.htaccess`, etc.
// Actual `http|https/...` cache files are nested. Files in the immediate directory are for other purposes.
&& ($_host_cache_dir !== $cache_dir || strpos($_file_dir->getSubpathname(), '/') !== FALSE)
// If NOT checking max age; or if we ARE, and the file has expired now.
&& (!$check_max_age || (!empty($max_age) && $_file_dir->getMTime() < $max_age))
) // Throw an exception if a deletion failure occurs.
{
if(!unlink($_file_dir->getPathname())) // Throw exception if unable to delete.
throw new \exception(sprintf(__('Unable to delete file: `%1$s`.', $this->text_domain), $_file_dir->getPathname()));
$counter++; // Increment counter for each file we delete.
}
else if(!$check_max_age && $regex === '/^.+/i' && $_file_dir->isDir()) // Directories too?
{
if(!rmdir($_file_dir->getPathname())) // Throw exception if unable to delete the directory itself.
throw new \exception(sprintf(__('Unable to delete dir: `%1$s`.', $this->text_domain), $_file_dir->getPathname()));
# $counter++; // Increment counter for each directory we delete. ~ NO don't do that here.
}
}
unset($_dir_regex_iteration, $_file_dir); // Housekeeping after this `foreach()` loop. I'm currently researching PHP bug reports related to I suppose it is possible that |
I just noticed that However, in my error logs I'm seeing entries associated with paths that do exist. So that doesn't explain the entire issue reported here in my view; at least not yet. The fact that symlinks are not returning a file modification time of their own though; that's going to be an issue of it's own for us to look at. |
Referencing: http://php.net/manual/en/function.lstat.php |
Good catch!
@jaswsinc Would you like me to open a new GitHub Issue for that, or do you see that being worked on as part of this issue? |
I think I can work on it as part of this issue. I'm working to improve the way this routine handles symlinks as part of the work to help resolve this, so I think I can just include it here. |
Cool. Sounds great. Thanks! |
@raamdev I submitted some pull requests that are now ready to merge. They work to resolve this issue. However, I'd like to leave this open for a couple of days while I work on a second PR to take things a step further after additional testing. |
Thank you. I reviewed this and merged them.
Copy that. I'll leave this open. |
I'm running the latest changes at s2Member.com to see if the |
So far so good. I'll leave it for another day or so. |
So far so good. I'll leave it until Monday and provide another update. |
@raamdev I think we have knocked this out finally. I'm not seeing the same issue since the latest improvements in the PRs submitted prior. I think it's safe to close this now and gather additional feedback during the RC phase. |
Copy that. Thank you for the testing! I will close this for further testing in the Release Candidate. |
Next release changelog:
|
@eurobank Quick Cache v150121 (Release Candidate) was released yesterday that includes further fixes for this issue. If you'd like to help test the Release Candidate, that would be greatly appreciated! Please see http://www.websharks-inc.com/post/quick-cache-v150121-release-candidate/ |
Last time i spoke tooo soon and the problem was not fixed. This time, after 3 days, i see no tmp leftover files or anything. |
@eurobank That's great to hear! Thank you for the update. :) |
Unfortunately, this update does not solve the problem for me... still many temp folders. Which information you need for diagnose? |
@Venique writes...
Which update are you referring to? Which version number specifically? |
The fixes applied from this issue have been released today with v150129:
See the v150129 announcement post. This issue will now be locked to further updates. If you have something to add related to this Issue, please open a new GitHub Issue and mention this one (#397). |
Forked from Issue #288 ("Fatal Error: 'Unable to clear dir'").
This has been an ongoing issue since implementing cache locking in #288. The bug presents itself as a cache directory with many
*-tmp
cache files that fail to clear when the Clear Cache button is clicked or when an automatic clear cache routine is run.A Quick Cache Pro user reports in a support ticket the following error appears at various times when Quick Cache runs a clear routine, such as when adding a new post:
@mchlbrry reports in #288 (comment):
@jaswsinc also reported seeing this
'SplFileInfo::getMTime(): stat failed
error on s2Member.com.The text was updated successfully, but these errors were encountered: