Cache directory to RAM, a little problem

I follow the article to set up my dedicated server available RAM to store the cache directory, I followed everything as it was explained, I can see that it’s working as expected, only today I noticed that in the error log Comet Cache can’t clean up the cache, there’s a fatal error. Here the error, if anybody can help I’d appreciate it, thanks.

29-Apr-2016 10:45:20 UTC] PHP Fatal error: Uncaught exception ‘Exception’ with message ‘Unable to delete files. Rename failure on directory: ‘/home/dedicated22/public_html/wp-content/cache/comet-cache/cache’.’ in /home/dedicated22/public_html/wp-content/plugins/comet-cache/src/includes/closures/Shared/CacheDirUtils.php:148

Stack trace:
#0 [internal function]: WebSharks\CometCache\AbsBaseAp->WebSharks\CometCache{closure} (’/^.+/i’, true)
#1 /home/dedicated22/public_html/wp-content/plugins/comet-cache/src/includes/classes/AbsBaseAp.php(55): call_user_func_array(Object(Closure), Array)
#2 /home/dedicated22/public_html/wp-content/plugins/comet-cache/src/includes/closures/Shared/CacheDirUtils.php(68): WebSharks\CometCache\AbsBaseAp->__call(‘deleteFilesFrom…’, Array)
#3 /home/dedicated22/public_html/wp-content/plugins/comet-cache/src/includes/closures/Shared/CacheDirUtils.php(68): WebSharks\CometCache\Plugin->deleteFilesFromCacheDir(’/^.+/i’, true)
#4 [internal function]: WebSharks\CometCache\AbsBaseAp->WebSharks\CometCache{closure} (’/^.+/i’)
#5 /home/dedicated22/public_html/wp-conte in /home/dedicated22/public_html/wp-content/plugins/comet-cache/src/includes/closures/Shared/CacheDirUtils.php on line 148

I suspect that you are using an older version of Comet Cache. You need to update.

I have Version 160417, I think it’s the most recent.
I suspect the problem is with the permissions on the /cache dir, I see root as owner and the sticky bit set 1777, I’m not sure what’s the proper course to take here.

That is the most recent version. But those errors talk of “closures” which have now been replaced by “traits”. So could you first try clearing the cache or, if that’s impossible, try turning Plugin Deletion Safeguards off, and then uninstall Comet Cache? Then reinstall it.

I’ll try that and report back, thanks.

Done, Comet Cache seems to work, no errors although I think it’s not using the RAM cache anymore, in fstab I can see this line

tmpfs /home/dedicated22/public_html/wp-content/cache/comet-cache/cache tmpfs defaults,size=128M 0 0

but when I check via terminal with the command df -h /home/dedicated22/public_html/wp-content/cache/comet-cache/cache;

I get this, it used to show 128M and how much was used.

Filesystem Size Used Avail Use% Mounted on
tmpfs 181G 19G 153G 11% /home/dedicated22/public_html/wp-content/cache/comet-cache/cache

When looking in wp-content/cache/ I see the following directories

/comet-cache (its /cache/http/ is filled with cached files as expected)
/comet-cache-5723e62df1ae7293382169-tmp (0755)
/comet-cache-5723e62df1ae7293382169-tmp/cache (empty with permission 1777)

Seven months have passed got no replies and I didn’t solve the problem, I’d really like to use this plugin since it was the only one to give my site a good boost.

As of today I tried to reinstall comet cache but this time I got this error.

“Plugin could not be activated because it triggered a fatal error.”
Warning: rename(/home/dedicated22/public_html/wp-content/cache/comet-cache/cache,/home/dedicated22/public_html/wp-content/cache/comet-cache/cache-5835ceeecac58522845544-tmp): Permission denied in /home/dedicated22/public_html/wp-content/plugins/comet-cache/src/includes/traits/Shared/CacheDirUtils.php on line 156

Fatal error: Uncaught exception ‘Exception’ with message ‘Unable to delete files. Rename failure on directory: /home/dedicated22/public_html/wp-content/cache/comet-cache/cache.’ in /home/dedicated22/public_html/wp-content/plugins/comet-cache/src/includes/traits/Shared/CacheDirUtils.php:157 Stack trace: #0 /home/dedicated22/public_html/wp-content/plugins/comet-cache/src/includes/traits/Shared/CacheDirUtils.php(282): WebSharks\CometCache\Classes\AbsBaseAp->deleteFilesFromCacheDir(’/^https?\/[^\/]…’, false) #1 /home/dedicated22/public_html/wp-content/plugins/comet-cache/src/includes/traits/Shared/CacheDirUtils.php(61): WebSharks\CometCache\Classes\AbsBaseAp->deleteFilesFromHostCacheDir(’/^.+/i’) #2 /home/dedicated22/public_html/wp-content/plugins/comet-cache/src/includes/traits/Plugin/WcpUtils.php(82): WebSharks\CometCache\Classes\AbsBaseAp->clearFilesFromHostCacheDir(’/^.+/i’) #3 /home/dedicated22/public_html/wp-content/plugins/comet-cache/src/includes/traits/Plugin/WcpUtils.php(239): WebSharks\CometCache\Classes\Plugin->clearCache() #4 /home/dedi in /home/dedicated22/public_html/wp-content/plugins/comet-cache/src/includes/traits/Shared/CacheDirUtils.php on line 157

I still have the ram cache enabled in tmpfs and I can’t maually delete the cache folder.

Some help is appreciated, thanks.

What version of PHP are you using?

I’m using PHP version 5.4.45.

I want to add that I have other WP installatiosn with Comet Cache enable and working perfectly, they are on the same server, the only difference is that I didn’t set up the cache dir to use RAM, so maybe I should revert these settings but the tutorial here https://cometcache.com/kb-article/how-to-use-ram-memory-for-your-cache-directory/ shows only how to set it up.

Maybe, but it seems a bit strange to me that you’d want to optimize your settings to this extent and yet still be running an out-of-date version of PHP. I suspect you’d see a bigger speed gain just by upgrading to PHP 7.