Post by HATEPOLICY » Sun Sep 16, 2012 4:48 am

Just wanted to post what I got in my error logs on 1.5.4.1

Code: Select all

PHP Warning:  unlink(/home4/bla/public_html/system/cache/cache.product.total.1.0.1.6a5cd25fa692974e13bf32bb2cf9fa87.1347724197) [<a href='function.unlink'>function.unlink</a>]: No such file or directory in /home4/bla/public_html/system/library/cache.php on line 45
and

Code: Select all

PHP Warning:  file_get_contents(/home4/bla/public_html/system/cache/cache.product.total.1.0.1.d9f1ed5791e772f1c55fc9cc989a64b8.1347741244) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: No such file or directory in /home4/bla/public_html/system/library/cache.php on line 9
Should I worry?
Thanks.

Skills: Ripp, copy, paste.


New member

Posts

Joined
Tue Nov 22, 2011 5:46 pm
Location - Boosting 30-80hz ranges.

Post by anung » Sun Sep 16, 2012 5:55 am

Check your cache folder permission is writeble or not, if not, make the folder writeble (777 or 755).

User avatar
Active Member

Posts

Joined
Fri Mar 30, 2012 10:32 am
Location - Indonesia

Post by HATEPOLICY » Sun Sep 16, 2012 7:29 am

Thanks for ur reply,

It was on 755, changed to 777, hope that sorts it.

Cheers.

Skills: Ripp, copy, paste.


New member

Posts

Joined
Tue Nov 22, 2011 5:46 pm
Location - Boosting 30-80hz ranges.

Post by HATEPOLICY » Sun Sep 16, 2012 8:32 pm

Nope, same errors today also...

So, should I be worried? :)

Thanks!

Skills: Ripp, copy, paste.


New member

Posts

Joined
Tue Nov 22, 2011 5:46 pm
Location - Boosting 30-80hz ranges.

Post by i2Paq » Sun Sep 16, 2012 9:57 pm

Sometimes a cache files is not existing anymore, that is when you get these errors (I believe).

There are some topics about this on our forums.

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by HATEPOLICY » Mon Sep 17, 2012 4:02 am

Thx for ur reply I2Paq, legit bug then I guess...don't worry I am not going to post it in the Elite forums ;)

Did some reading on cache, kinda got lost tho!
Couldn't find much in regards to my specific errors.

Will report back if anything else pops up.

Got this now also:

Code: Select all

Undefined index:  last_order_id in /home4/bla/public_html/catalog/controller/checkout/success.php on line 68
Cheers.

Skills: Ripp, copy, paste.


New member

Posts

Joined
Tue Nov 22, 2011 5:46 pm
Location - Boosting 30-80hz ranges.

Post by renatogs » Sat Nov 17, 2012 9:19 pm

I have same errors!

Newbie

Posts

Joined
Sat Nov 17, 2012 2:15 am

Post by renatogs » Sun Nov 25, 2012 12:13 am

Did you fix the error?

My cache folder everyday have 3000 arquivos cache.

I think it isn´t normal!

Newbie

Posts

Joined
Sat Nov 17, 2012 2:15 am

Post by dachiaru » Fri Jan 11, 2013 9:39 pm

I have same errors!

you solved the problem?

Consulenza informatica. Soluzione web su misura. Creazione siti web. Creazione soluzioni eCommerce avanzate opencart, joomla, wordpress. Creazione extension. Ottimizzazione SEO, servizio posizionamento web professionale e garantito.
INFO SITI: https://www.masterwebsite.it
CONTATTO SKYPE: masterwebsite.it


User avatar
Active Member

Posts

Joined
Mon Oct 22, 2012 5:39 pm
Location - Roma

Post by jfn99 » Wed Jan 16, 2013 9:33 pm

I'm having the same problem... any one found a solution? please post!

New member

Posts

Joined
Thu Feb 25, 2010 5:14 pm

Post by rph » Thu Jan 17, 2013 2:45 am

Just clear the errors. They can be ignored.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by jfn99 » Tue Jan 22, 2013 1:56 am

Any way to stop these errors to show up?

Code: Select all

2013-01-21 16:47:32 - PHP Warning:  file_get_contents(/home/******/public_html/system/cache/cache.product.total.2.0.1.443d1b471d5c27fd802cd68f8cd126c3.1358790436) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: No such file or directory in /home/******/public_html/system/library/cache.php on line 9
2013-01-21 17:03:22 - PHP Warning:  file_get_contents(/home/******/public_html/system/cache/cache.product.total.2.0.1.472c2fef3b8bdbd661efd29bed8ca590.1358791401) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: No such file or directory in /home/******/public_html/system/library/cache.php on line 9
2013-01-21 17:03:22 - PHP Warning:  file_get_contents(/home/******/public_html/system/cache/cache.product.total.2.0.1.308ccb6cbc0aa0ecc7a86b303e9f0005.1358791401) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: No such file or directory in /home/******/public_html/system/library/cache.php on line 9
2013-01-21 17:26:57 - PHP Warning:  unlink(/home/******/public_html/system/cache/cache.product.total.2.0.1.a2b2d8fa2854da5a48cdb889f8f8a628.1358792817) [<a href='function.unlink'>function.unlink</a>]: No such file or directory in /home/******/public_html/system/library/cache.php on line 45
2013-01-21 17:30:51 - PHP Warning:  unlink(/home/******/public_html/system/cache/cache.product.total.2.0.1.f2ca1894d140cc8f60bb9cbbf2422ee0.1358793051) [<a href='function.unlink'>function.unlink</a>]: No such file or directory in /home/******/public_html/system/library/cache.php on line 45
2013-01-21 17:30:52 - PHP Warning:  unlink(/home/******/public_html/system/cache/cache.product.total.2.0.1.dfb9aaea846ac6b06d365047b2819d4f.1358793051) [<a href='function.unlink'>function.unlink</a>]: No such file or directory in /home/******/public_html/system/library/cache.php on line 45
2013-01-21 17:30:52 - PHP Warning:  unlink(/home/******/public_html/system/cache/cache.product.total.2.0.1.e30e83954c1fe05186a017655f9fb23f.1358793051) [<a href='function.unlink'>function.unlink</a>]: No such file or directory in /home/******/public_html/system/library/cache.php on line 45
2013-01-21 17:30:52 - PHP Warning:  unlink(/home/******/public_html/system/cache/cache.product.total.2.0.1.22bd9de096ed92bc164d89bd3f5fd1e2.1358793051) [<a href='function.unlink'>function.unlink</a>]: No such file or directory in /home/******/public_html/system/library/cache.php on line 45

New member

Posts

Joined
Thu Feb 25, 2010 5:14 pm

Post by MikeSCC » Tue Feb 05, 2013 7:45 pm

Hi,

I am also getting these errors - was there a solution for this issue?

Thanks,

Mike

Active Member

Posts

Joined
Tue Nov 20, 2012 5:55 pm

Post by Daniel » Wed Feb 06, 2013 12:34 am

they should turn up less in the latest version as i have removed caching for products and categories.

there is not much that can be done to stop this. you are talking fractions of seconds between selecting a file to be deleted and it being already deleted. just depends on the traffic on your site.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by MikeSCC » Wed Feb 06, 2013 1:06 am

Daniel wrote:they should turn up less in the latest version as i have removed caching for products and categories.

there is not much that can be done to stop this. you are talking fractions of seconds between selecting a file to be deleted and it being already deleted. just depends on the traffic on your site.
Thanks for your help.

Cheers,

Mike

Active Member

Posts

Joined
Tue Nov 20, 2012 5:55 pm

Post by JonnyR » Thu Aug 01, 2013 9:00 pm

Hi Guys! Just found this module http://www.opencart.com/index.php?route ... n_id=13067. It should help with such errors.

Newbie

Posts

Joined
Thu Aug 01, 2013 7:19 pm

Post by ocatfni » Sat Aug 03, 2013 1:21 pm

We were seeing similar errors. We have an extension installed that was creating tens of thousands of cache files (a hook added in the "getTotalProducts(...)" function). In addition to errors like these, we found the site slowed to a crawl. We have improved the situation greatly, perhaps resolved it altogether, by modifying the "upload/system/library/cache.php" script.

The version of OpenCart we are using is 1.5.1.3.1. I've peeked at the OpenCart 1.5.6 version and, though the code has changed slightly between the two versions, it appears the reworking we did remains applicable and will be beneficial to those having similar problems with degraded performance and cache file unlinking errors.

In a nutshell, the current caching implementation requests a "glob(...)" in the cache directory at instantiation (in version 1.5.1.3.1 but not in version 1.5.6) and also again every time the "get(...)" and "set(...)" (via the delete(...)) functions are called. The "glob(...)" function is expensive, especially with tens of thousands of directory entries, and this was devastating to performance. Furthermore, in version 1.5.1.3.1, a call to "clearstatcache(...)" was being made after each unique cache file unlink. A single clearing of the cache after completion would suffice. For race conditions where a cache file is unlinked by another process, there is currently no "@" prefix to the "unlink(...)" call to hide the error (which really isn't an error because, ultimately, the file is gone as desired).

So ... to improve in these areas ... try replacing the contents of the "upload/system/library/cache.php" script with these contents (and let the forum know if it helps -- maybe the ideas here will find their way into the code base) :

Code: Select all

<?php

  final class Cache
  {
    private $expire = 3600;
    private $files = NULL;

    public function __construct()
    {
      $files = @glob(DIR_CACHE . 'cache.*');
      if($files === FALSE)
      {
        $files = array();
      }

      foreach($files as $cnt => $file)
      {
        $time = substr(strrchr($file, '.'), 1);
        if($time < time())
        {
          if(@file_exists($file))
          {
            @unlink($file);
          }
          unset($files[$cnt]);
        }
      }
      clearstatcache();
      $files = array_values($files);

      $this->files = $files;
    }

    public function get($key)
    {
      $cache = NULL;

      $target = DIR_CACHE . 'cache.' . preg_replace('/[^A-Z0-9\._-]/i', '', $key) . '.';
      $length = strlen($target);
      foreach($this->files as $file)
      {
        if(strncmp($file, $target, $length) == 0)
        {
          $cache = @file_get_contents($file);
          if($cache)
          {
            $cache = unserialize($cache);
          }
        }
      }

      return $cache;
    }

    public function set($key, $value)
    {
      $file = DIR_CACHE . 'cache.' . preg_replace('/[^A-Z0-9\._-]/i', '', $key) . '.' . (time() + $this->expire);
      $handle = @fopen($file, 'w');
      if($handle)
      {
        @fwrite($handle, serialize($value));
        @fclose($handle);
        $this->files[] = $file;
      }
    }

    public function delete($key)
    {
      $target = DIR_CACHE . 'cache.' . preg_replace('/[^A-Z0-9\._-]/i', '', $key) . '.';
      $length = strlen($target);
      foreach($this->files as $file)
      {
        if(strncmp($file, $target, $length) == 0)
        {
          if(@file_exists($file))
          {
            @unlink($file);
          }
        }
      }
      clearstatcache();
    }
  }

?>
Good luck!

Newbie

Posts

Joined
Wed Aug 18, 2010 10:43 pm

Post by byens » Thu Oct 24, 2013 10:31 am

JonnyR wrote:Hi Guys! Just found this module http://www.opencart.com/index.php?route ... n_id=13067. It should help with such errors.
Thanks after added this mod, unlink error was gone. But php file gets contents still there
ocatfni wrote:We were seeing similar errors. We have an extension installed that was creating tens of thousands of cache files (a hook added in the "getTotalProducts(...)" function). In addition to errors like these, we found the site slowed to a crawl. We have improved the situation greatly, perhaps resolved it altogether, by modifying the "upload/system/library/cache.php" script.

The version of OpenCart we are using is 1.5.1.3.1. I've peeked at the OpenCart 1.5.6 version and, though the code has changed slightly between the two versions, it appears the reworking we did remains applicable and will be beneficial to those having similar problems with degraded performance and cache file unlinking errors.

In a nutshell, the current caching implementation requests a "glob(...)" in the cache directory at instantiation (in version 1.5.1.3.1 but not in version 1.5.6) and also again every time the "get(...)" and "set(...)" (via the delete(...)) functions are called. The "glob(...)" function is expensive, especially with tens of thousands of directory entries, and this was devastating to performance. Furthermore, in version 1.5.1.3.1, a call to "clearstatcache(...)" was being made after each unique cache file unlink. A single clearing of the cache after completion would suffice. For race conditions where a cache file is unlinked by another process, there is currently no "@" prefix to the "unlink(...)" call to hide the error (which really isn't an error because, ultimately, the file is gone as desired).

So ... to improve in these areas ... try replacing the contents of the "upload/system/library/cache.php" script with these contents (and let the forum know if it helps -- maybe the ideas here will find their way into the code base) :

Code: Select all

<?php

  final class Cache
  {
    private $expire = 3600;
    private $files = NULL;

    public function __construct()
    {
      $files = @glob(DIR_CACHE . 'cache.*');
      if($files === FALSE)
      {
        $files = array();
      }

      foreach($files as $cnt => $file)
      {
        $time = substr(strrchr($file, '.'), 1);
        if($time < time())
        {
          if(@file_exists($file))
          {
            @unlink($file);
          }
          unset($files[$cnt]);
        }
      }
      clearstatcache();
      $files = array_values($files);

      $this->files = $files;
    }

    public function get($key)
    {
      $cache = NULL;

      $target = DIR_CACHE . 'cache.' . preg_replace('/[^A-Z0-9\._-]/i', '', $key) . '.';
      $length = strlen($target);
      foreach($this->files as $file)
      {
        if(strncmp($file, $target, $length) == 0)
        {
          $cache = @file_get_contents($file);
          if($cache)
          {
            $cache = unserialize($cache);
          }
        }
      }

      return $cache;
    }

    public function set($key, $value)
    {
      $file = DIR_CACHE . 'cache.' . preg_replace('/[^A-Z0-9\._-]/i', '', $key) . '.' . (time() + $this->expire);
      $handle = @fopen($file, 'w');
      if($handle)
      {
        @fwrite($handle, serialize($value));
        @fclose($handle);
        $this->files[] = $file;
      }
    }

    public function delete($key)
    {
      $target = DIR_CACHE . 'cache.' . preg_replace('/[^A-Z0-9\._-]/i', '', $key) . '.';
      $length = strlen($target);
      foreach($this->files as $file)
      {
        if(strncmp($file, $target, $length) == 0)
        {
          if(@file_exists($file))
          {
            @unlink($file);
          }
        }
      }
      clearstatcache();
    }
  }

?>
Good luck!
Thanks
I will try this by replacing my cache.php

Selling Kristik - Jasa Foto Aura - Jual Lingerie - supplier baju anak - jasa seo


Active Member

Posts

Joined
Sat Dec 11, 2010 12:29 pm
Location - Surabaya

Post by rph » Thu Oct 24, 2013 6:52 pm

ocatfni wrote: For race conditions where a cache file is unlinked by another process, there is currently no "@" prefix to the "unlink(...)" call to hide the error (which really isn't an error because, ultimately, the file is gone as desired).
OpenCart has its own error handler so error suppression won't do anything.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska
Who is online

Users browsing this forum: No registered users and 10 guests