Post by labeshops » Mon Jul 18, 2016 7:42 pm

Since upgrading to 2.2 I have noticed that vqmod/checked.cache.php gets HUGE now and then and crashes my stores. I get memory exhausted error in backend. This am it was over 8,000,000 and caused the error.

This file was not part of vqmod in 1.5 so I don't know what it does? Is there a way to disable it or auto clear it every day?

Running Opencart v2.2 with multi-stores from http://www.labeshops.com which has links to all my stores.

Image


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by pprmkr » Mon Jul 18, 2016 11:23 pm

vQmod should clear cache on every rebuild.
Line 251 of vqmod.php:

Code: Select all

		// Clear checked cache if rebuilding
		file_put_contents(self::path(self::$checkedCache, true), '', LOCK_EX);

User avatar
Active Member

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands

Post by labeshops » Tue Jul 19, 2016 12:18 am

pprmkr wrote:vQmod should clear cache on every rebuild.
Line 251 of vqmod.php:

Code: Select all

		// Clear checked cache if rebuilding
		file_put_contents(self::path(self::$checkedCache, true), '', LOCK_EX);
Rebuild meaning when I clear and refresh via the modifications menu? Thought that was just for ocmod???

I did rebuild a lot as I was getting things set up, but now that they are, haven't changed anything in a week or more.

Running Opencart v2.2 with multi-stores from http://www.labeshops.com which has links to all my stores.

Image


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by labeshops » Thu Jul 21, 2016 3:36 am

Anyone have an idea on this one? It happened again this am and broke the stores.

Running Opencart v2.2 with multi-stores from http://www.labeshops.com which has links to all my stores.

Image


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by pprmkr » Thu Jul 21, 2016 1:25 pm

When new xml added or a file is changed, vQmod does all modifications and clears checked.cache by writing an empty ''

When you checked.cache keeps growing, it is possible that at the moment script want to write '', file is locked due to other process writing.

Perhaps adding extra code helps? Try getting return value of file_put_contents at line 251 of /vqmod/vqmod.php:

Code: Select all

$cache_cleared = file_put_contents(self::path(self::$checkedCache, true), '', LOCK_EX);

if ($cache_cleared === false) {
  // do it again?
 // or log it 
}
To reset vqmod, delete checked.cache, mods.cache and contents of folder vqcache and logs.
Then browse your website to force vqmod to rewrite all modifications
When all modifications are written, check and remember the size of cache files.

After a while check the size again.

User avatar
Active Member

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands

Post by labeshops » Thu Jul 21, 2016 7:27 pm

pprmkr wrote:When new xml added or a file is changed, vQmod does all modifications and clears checked.cache by writing an empty ''

When you checked.cache keeps growing, it is possible that at the moment script want to write '', file is locked due to other process writing.

Perhaps adding extra code helps? Try getting return value of file_put_contents at line 251 of /vqmod/vqmod.php:

Code: Select all

$cache_cleared = file_put_contents(self::path(self::$checkedCache, true), '', LOCK_EX);

if ($cache_cleared === false) {
  // do it again?
 // or log it 
}
To reset vqmod, delete checked.cache, mods.cache and contents of folder vqcache and logs.
Then browse your website to force vqmod to rewrite all modifications
When all modifications are written, check and remember the size of cache files.

After a while check the size again.
Where exactly should I put that code? line 251 is a } the close of

Code: Select all

		if(file_exists($cacheFile) && filemtime($cacheFile) >= self::$_lastModifiedTime && filemtime($cacheFile) >= $file_last_modified) {

			return $cacheFile;

		}
Should I try your code before or after this???

I tried putting it after it and it caused my store fronts to be a blank white page so have removed it again.

Running Opencart v2.2 with multi-stores from http://www.labeshops.com which has links to all my stores.

Image


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by pprmkr » Thu Jul 21, 2016 7:54 pm

I have version 2.5.1 installed.
The code you show is from older version, perhaps 2.3.2 ?

I suggest you uninstall this version and get 2.5.1 or try the latest 2.6.1

User avatar
Active Member

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands

Post by JNeuhoff » Thu Jul 21, 2016 8:39 pm

labeshops wrote:
Rebuild meaning when I clear and refresh via the modifications menu? Thought that was just for ocmod???

I did rebuild a lot as I was getting things set up, but now that they are, haven't changed anything in a week or more.
If you use VQmod from https://github.com/vqmod/vqmod/releases then its vqmod/vqcache/* or its vqmod/*.cache files are not refreshed by a Extensions > Modifications > Refresh, the latter is only for OCmod. If your problem still persists after upgrading to the latest VQmod, you could try the Integrated VQmod which is basically OCmod with added VQmod XML syntax support, the latter doesn't use the vqmod/vqcache/* nor vqmod/*.cache and works more like OCmod.

MHC Web Design
Override Engine * Integrated VQMod * Unused Images Manager * Instant Option Price Calculator * TrustPilot Reviews * Google Rich Snippets * Google Tag Manager * Export/Import Tool * Template Switcher PHP/Twig


User avatar
Expert Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by labeshops » Fri Jul 22, 2016 6:53 am

JNeuhoff wrote:
labeshops wrote:
Rebuild meaning when I clear and refresh via the modifications menu? Thought that was just for ocmod???

I did rebuild a lot as I was getting things set up, but now that they are, haven't changed anything in a week or more.
If you use VQmod from https://github.com/vqmod/vqmod/releases then its vqmod/vqcache/* or its vqmod/*.cache files are not refreshed by a Extensions > Modifications > Refresh, the latter is only for OCmod. If your problem still persists after upgrading to the latest VQmod, you could try the Integrated VQmod which is basically OCmod with added VQmod XML syntax support, the latter doesn't use the vqmod/vqcache/* nor vqmod/*.cache and works more like OCmod.
It is the latest version. says

Code: Select all

abstract class VQMod {
	public static $_vqversion = '2.6.1';	
in my vqmod.php file

Not sure what the integrated vqmod is but I'm not fond of ocmod - cannot figure out how to easily modify things like I can in vqmod, so would rather use vqmod.

What is checked.cache anyway? Seems like it just gets huge very, very fast.

Running Opencart v2.2 with multi-stores from http://www.labeshops.com which has links to all my stores.

Image


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by labeshops » Sun Jul 24, 2016 7:23 pm

I know nothing about cron jobs, but is there some way I can set up something like that to delete the checked.cache every few hours? My sites died again over night due to it being huge again :(

Running Opencart v2.2 with multi-stores from http://www.labeshops.com which has links to all my stores.

Image


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by HansenDK » Tue Sep 04, 2018 5:24 pm

labeshops wrote:
Sun Jul 24, 2016 7:23 pm
I know nothing about cron jobs, but is there some way I can set up something like that to delete the checked.cache every few hours? My sites died again over night due to it being huge again :(
Hi Labeshops, Did you ever find a solution for this, other than deleting the file every time the shop is down ? I have the same problem

Newbie

Posts

Joined
Sun Nov 03, 2013 6:04 pm

Post by IP_CAM » Tue Sep 04, 2018 7:47 pm

Well, one could try MaxD's famous VqMod Pro Version 2.61, it handles a few things in a different way, by
automatically cleaning out and 'renewing' the cached file Content after a 'given' time, similar to a cron job.
(Wich seldom leads to a NOT FOUND Error, when playing around in Admin, and something tries to link
some Code, wich no longer exists, during such a Cache Clean Function Process, just to have it mentiond.
But it happen very seldom, and only happen one Pageload long, then, everything works again !)

Code: Select all

if (!file_exists(substr(DIR_SYSTEM,0,-7).'vqmod/pro.cache') || filemtime(substr(DIR_SYSTEM,0,-7).'vqmod/pro.cache') < time() - 180) { 
One only needs to RENAME the default OC system/helper/json.php file first, OR it will be overwritten,
if VqMod Pro is installed. There is no install process, since this will be done automatically as well.
I had great success by use of that Extension for my v.1.5.6.5_rc, and I assume, that it will function in later
OC Versions as well. And if not, scrap it, and use the default json.php file again. :D And it works, combined
with my VqMod/OcMod-Installation on ipcam.li, so, OcMod itself should not be a problem, at best, some linkings, if so ...
Just figured ...
Ernie
--
PS: Still, it would be helpful, to see into one of those giant sized cache-temp-files, to find out, what it
contains on links ... ;)
---
download/file.php?mode=view&id=35508
---

Attachments

vqmod_pro.jpg

vqmod_pro.jpg (477.25 KiB) Viewed 2069 times


I'm rarely still active at the OC Forum. To reach me, contact: jti@jacob.ch
A Demoversion of my free OpenCart LIGHT v.1.5.6.5 Software Edition
can be seen in real Action here: http://www.jti.li/shop/
---
1'000+ FREE OC Extension-Repositories - from OC v.1.5.x up,
on the world's largest OC-related Github Site: https://github.com/IP-CAM
---
Image


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by Qphoria » Fri May 24, 2019 5:20 am

So the issue is with the new push from the admin to move the "storage" folder out of the public_html folder.
This isn't a bad idea for files, but isn't really needed for modification files but they are lumped underneath storage.
vqmod can't cache files in a directory higher than itself so it regenerates them every time. But note, this is only for files that are being ocmodded first and then being vqmodded... so it's relatively harmless unless you have a ton of ocmods and vqmods altering the same files.

A quick fix is after moving the storage to a higher level area, update the config.php and admin/config.php files to change

Code: Select all

define('DIR_MODIFICATION', DIR_STORAGE . 'modification/')
to

Code: Select all

define('DIR_MODIFICATION', DIR_SYSTEM . 'modification/')
That will keep the modifications folder under the parent directory and fix the issue

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Qphoria » Fri May 24, 2019 5:21 am

So the issue is with the new push from the admin to move the "storage" folder out of the public_html folder.
This isn't a bad idea for upload and download files, but isn't really needed for modification files but they are lumped underneath storage.
vqmod can't cache files in a directory higher than itself so it regenerates them every time. But note, this is only for files that are being ocmodded first and then being vqmodded... so it's relatively harmless unless you have a ton of ocmods and vqmods altering the same files.

A quick fix is after moving the storage to a higher level area, update the config.php and admin/config.php files to change

Code: Select all

define('DIR_MODIFICATION', DIR_STORAGE . 'modification/')
to

Code: Select all

define('DIR_MODIFICATION', DIR_SYSTEM . 'modification/')
That will keep only the modifications folder under the system directory and fix the issue

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by oc-hastings » Mon Jul 29, 2019 8:34 pm

Thanks Qphoria

This looks hopeful. Our checked.cache reached 60MB and took down the site.

I have located the /config.php and admin/config.php files but I'm not sure what you mean by '... after moving the storage to a higher level area..'?

Thanks for your help.

Newbie

Posts

Joined
Fri Jan 16, 2015 10:58 pm
Who is online

Users browsing this forum: No registered users and 3 guests