Cache folders not removed during clean up process

Under my /wp-content/cache/comet-cache/cache/http/mysite-com there are lots of files and folders

Files seem to be ok, as the the oldest one is less than 3 hours old, my max age=2 hours and cleanup schedule=hourly.

However there are folders with dates all the way from from the day I installed Comet Cache until today. Oldest folders are empty, but the folder itself persist.

@teknofilo That sounds like a permissions issue — the only reason those old directories would still be there is if Comet Cache was unable to delete them due to a permissions issue.

If you click the “Clear Cache” button in Comet Cache, do the old directories get deleted? If not, then you definitely have a permissions issue.

When I click the “Clear Cache” button, the old directories do NOT get deleted.

However, there are no differences between the permissions and owners of those directories and the permissions and owners of the files.

Example:

File1.html -rw-r–r-- www-data www-data
Folder1 drwxr-xr-x www-data www-data

RaamDev,

I have debugged the code, and folders are not even tried to be deleted because execution always ends here for directories:

public function deleteFilesFromCacheDir($regex, $check_max_age = false)
[…]
case ‘dir’: // A regular directory; i.e., not a symlink.
if ($regex !== ‘/^.+/i’) {
break; // Not deleting everything.
}

When I debug at that point, I see that the value of the $regex variable is /^https?/[^/]+/.+/i for all directories, so the function breaks at that point and thus the directory is not deleted

@teknofilo Right, when it breaks at that point that indicates that the routine for the “Clear Cache” button is not being run, i.e., a different routine is calling that deleteFilesFromCacheDir() function.

I have tested this several times on my test site and every time I click the “Clear Cache” button, the entire cache directory is emptied, including all directories.

Have you tried manually deleting those old directories and then seeing if Comet Cache works the way it’s supposed to? Maybe there’s something odd about those old directories.

Have you tried manually deleting those old directories and then seeing if Comet Cache works the way it’s supposed to?

Yes, I deleted them with no issues but now the cache dir is, once again, full of empty dirs that never get deleted.

When I click the “Clear Cache” button, the ‘deleteFilesFromCacheDir’ function always breaks at the point I indicated, so the dir does not get deleted. So the issue is not related to permissions of the dirs… but related to the script never attempting to delete those dirs.

Right now there are 4605 dirs and 844 files at /cache/comet-cache/cache/http/www-mysite-com. Some of the dirs are two days old (I deleted all empty dirs two days ago), while files are less than 3 hours old (max age=2 hours and cleanup process=hourly)

@teknofilo Have you tried reproducing this on another site, preferably on another server? I have not been able to reproduce this issue at all and with over 100,000 active installs, we have not had any other reports like this. See also: Testing Comet Cache in a Clean WordPress Installation

No, I don’t have access to another server to test.

Is there anything I can do on my site to help you debug the problem?

If you’re a Comet Cache Pro customer, you can open a support ticket and I’ll see if I can take a closer look at your site.