Jump to content

Caching Error


kixe
 Share

Recommended Posts

From time to time I receive an error notice from a live site I made.

Page: http://example.org/en/media/live-recording/
User: guest

Error:
Exception: Unable to create path: […]/site/assets/cache/Page/2040/ (in […]/wire/core/CacheFile.php line 62)

This doesn't happen if I call the page from my computer, with any browser, even if I am not loggedin (guest). In each case the path will be created. Why is the system unable to create the cache path in some cases? Any experiences?

Link to comment
Share on other sites

@LostKobrakai
The template cache interval is one week for the related pages but the problem is not the creation/ recreation of the cache file. This works as expected. Only the creation of the page related directory doesn't work sometimes. I have some similar configurations on other hosts without problems like this. I am in touch with the support, but still no idea.

Link to comment
Share on other sites

@LostKobrakai I am not sure if I explained my problem well. I will try again.
The fact that the directory cannot be created results in the error I mentioned above. It is always the first time the system tries to create the directory.
Since CacheFile constructor throws an Exception after WireFileTools::mkdir() returns false, the page visitor (guest user) will get a notice instead of an uncached site:
Unable to complete this request due to an error. - Error has been logged. Administrator has been notified.

This is inacceptable for a site in production mode.
If a directory is created once it will not be deleted later, except manually. There is no problem to save or replace the cachefiles in the folder.
Only chance to go around this is to disable caching.

Link to comment
Share on other sites

Problem still exists. What i did until now:

I modified the core function WireFileTools::mkdir() to get more detailed information about what is going on.
Error occurs because PHP::mkdir() is not able to create the directory and returns false.
I deleted the page cache completely to let ProcessWire recreate the cache.
After a few days most of the cachefiles are recreated as normal, some cache files are overwritten/ updated.
But still in some cases PHP::mkdir() is not able to create the directory and return false. I added a sleep(2) after the first fail to try again after 2 seconds with same result. Maybe not a race condition then.
I cannot see any issues on parent directories. @LostKobrakai Could you specify which kind of issues on one/some of the parent directories could cause this problems?

About CacheFile class:
I think if the CacheFile constructor fails, the output of the page shouldn't stop. Better solution would be logging an error and output the uncached page.

Any help appreciated! :(


 

 

Link to comment
Share on other sites

On 28/11/2016 at 8:09 PM, kixe said:

The error occurs always at the same minute (22). Once or twice a day. No cronjobs running hourly. Cannot figure out what the problem is.

Could it be that the host is running some maintenance task on a regular basis that makes the file system unwriteable? Of course that shouldn't happen, but at this point if you're willing to try anything you could copy the site to a different host and see if the issue still occurs. I guess you would need to simulate browser traffic for testing - I don't know much about that, maybe JMeter?

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...