kixe Posted November 23, 2016 Share Posted November 23, 2016 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 More sharing options...
LostKobrakai Posted November 23, 2016 Share Posted November 23, 2016 Maybe a race condition? Two people hitting the cache expiration time at the exact moment? 1 Link to comment Share on other sites More sharing options...
kixe Posted November 28, 2016 Author Share Posted November 28, 2016 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. Link to comment Share on other sites More sharing options...
LostKobrakai Posted November 28, 2016 Share Posted November 28, 2016 The error is happening when a new cache file is being created, so it's naturally happening in fixed intervals corresponding to the cache time. Link to comment Share on other sites More sharing options...
kixe Posted November 28, 2016 Author Share Posted November 28, 2016 @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 More sharing options...
LostKobrakai Posted November 28, 2016 Share Posted November 28, 2016 I wouldn't focus so much on the fact that a directory cannot be created, but rather look what might result in that. If that error is happening when the cache file is still warm then it's questionable why there's even an attempt to create that folder. Link to comment Share on other sites More sharing options...
kixe Posted November 28, 2016 Author Share Posted November 28, 2016 @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 More sharing options...
LostKobrakai Posted November 28, 2016 Share Posted November 28, 2016 I'd try looking for what does change between the first time the directory should be created and the second time. Maybe there are issues on one/some of the parent directories of the cache. Link to comment Share on other sites More sharing options...
kixe Posted December 5, 2016 Author Share Posted December 5, 2016 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 More sharing options...
Robin S Posted December 5, 2016 Share Posted December 5, 2016 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? 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now