Jump to content

HUGE Apache Error_Log file- bazillions of "Cleaning Cache" ent


grafis
 Share

Recommended Posts

Whenever I FTP to my site I notice the Apache Error_Log file is huge (2,5,10,20,60.... megs). Currently the file is two days old and I already have 7,922 entries. It appears CubeCart is telling the system to log any action? This does not happen on the same host (Site5) with Wordpress, Drupal or CS Cart. Does anyone else see this issue? 

 

These are "errors" that have occurred over the last 36 hrs - an entry ever 15 seconds or so 24x7x365.

  1. 5,958 entriesPHP Notice:  Cleaning cached files... in /home/mysite/public_html/classes/cache/cache.class.php on line 134 
    Looked at the code and poked around - the issue appears to be all files in  /Cache/Skin are being deleted every 2-3 minutes. That can't be good!
     
  2. 774 entries: PHP Warning:  Invalid argument supplied for foreach() in /home/luciasim/public_html/admin/sources/products.index.inc.php on line 348

     

  3. 351 entries: PHP Warning:  SimpleXMLElement::__construct() [<a href='http://docs.php.net/manual/en/simplexmlelement.--construct.php'>simplexmlelement.--construct.php</a>]: Entity: line 1: parser error : Space required after the Public Identifier in /home/mysite/public_html/admin/sources/dashboard.index.inc.php on line 269
     
  4. 273 entries: PHP Notice:  GD::gdLoadFile - Unknown file type in /home/luciasim/public_html/classes/gd.class.php on line 75
     
  5. 232 errors: PHP Notice: UPS Error for Canada Standard: The requested service is invalid from the selected origin. in /home/mysite/public_html/modules/shipping/UPS/shipping.class.php on line 210
     
  6. 147 entries: PHP Warning:  implode() [<a href='http://docs.php.net/manual/en/function.implode.php'>function.implode.php</a>]: Invalid arguments passed in /home/luciasim/public_html/admin/sources/products.index.inc.php on line 1090

     

  7. 13 entries: PHP Warning:  String could not be parsed as XML in /home/mysite/public_html/admin/sources/dashboard.index.inc.php on line 28

 

 

 

 

 

Link to comment
Share on other sites

Let's work on the first error notice for now. There are supposed to be only two places where Cache->tidy() is called:

(299) adminsourcesmaintenance.index.inc.php

(137) classesdebug.class.php

 

In maintenance, the admin must check "Clear Cache" which posts 'clearCache'.

 

In debug, when enabled, presents a grey section below the page display with diagnostic information. At the bottom is a review of the Cache with a link to Clear Cache. This link will have the browser request the current page but also includes in the URL &debug-cache-clear.

 

So, obviously there is something else that has a Cache->tidy() statement, or there is something that continuously adds 'get_cache_clear' to the $_GET array early in CubeCart's wake-up process.

 

If any of this is reminding you of an edit you may have made and lost track of, please go find it.

 

If not, then this is what I would like for you to try:

In the file /classes/cache/cache.class.php, at line 133, after the open brace, add:

if( function_exists('dbg') ) dbg(__METHOD__);

 

Then, copy the following code into a new file called ini-custom.php ini-custom.inc.php, saved in the root folder of your store:

<?php
function dbg ($dbgMsg,$dbgTrace=false,$isTrace=true,$dbg_nl = "rn") {
    if(is_bool($dbgMsg)) $dbgMsg = ($dbgMsg) ? "True" : "False" ;
    $dbgMsg = (isset($dbgMsg)) ? $dbgMsg : '' ;
    $dbgMsg .= $dbg_nl;
    if($isTrace) {
        $dbgTrace = ($dbgTrace === false) ? array_reverse(debug_backtrace()) : array_reverse($dbgTrace) ;
        foreach($dbgTrace as $dbg_index => $dbg_info) {
            $key = 0;
            $info = array('args' => array());
            if(is_array($dbg_info['args'])) {
                foreach($dbg_info['args'] as $arg) {
                    if($arg === true): $info['args'][$key] = 'true';
                    elseif($arg === false): $info['args'][$key] = 'false';
                    elseif(empty($arg) && !is_numeric($arg)): $info['args'][$key] = 'empty';
                    elseif(is_string($arg)): $info['args'][$key] = ($arg === '')? "-zls-" : "'$arg'";
                    else: $info['args'][$key] = $arg;
                    endif;
                    ++$key;
                }
            } else {
                $info['args'] = $dbg_info['args'];
            }
            $dbgMsg .= "t at $dbg_index ".basename($dbg_info['file'])." (line {$dbg_info['line']}) ".ucfirst(basename($dbgTrace[$dbg_index + 1]['file'],'.class.php'))."->{$dbg_info['function']}(".(is_array($info['args']) ? @join(',',$info['args']) : $info['args']).")$dbg_nl";
        }
    } else {
        if(is_array($dbgTrace)) {
            foreach($dbgTrace as $dbg_index => $dbg_info) {
                if (is_array($dbg_info)): $dbgMsg .= "t $dbg_index => ". print_r($dbg_info,true) . $dbg_nl;
                elseif(is_bool($dbg_info)): $dbgMsg .= "t $dbg_index => ". (($dbg_info)?"true":"false") . $dbg_nl;
                else: $dbgMsg .= "t $dbg_index => ". $dbg_info . $dbg_nl;
                endif;
            }
        } else {
            $dbgMsg .= "t $dbgTrace".$dbg_nl;
        }
    }
    $dbgMsg .= $dbg_nl;
    $dbg_fp = fopen(CC_ROOT_DIR.CC_DS."dbg_log.txt", "a");
    fwrite($dbg_fp, $dbgMsg."-------------".$dbg_nl);
    fclose($dbg_fp);
}
dbg(strftime('%X').date('T')." - ".strftime('%x'),array($_SERVER['REQUEST_URI'],$_SERVER['REMOTE_ADDR'],$_COOKIE['PHPSESSID']),false);
?>

This will record into a file called dbg_log.txt in the root folder, the series of function calls PHP traversed to get to the tidy() statement.

 

I think you will only need to have this file in place for a few minutes.

 

Let us know what it says.

Link to comment
Share on other sites

For number 2, it seems a web form that has a file-type input element will always submit the element's name even though there is no value to go with it, that is, there is no file being uploaded. Unfortunately, in this case, Filemanager->upload() does not return false or an empty array (I forget what it does return).

 

In the file /admin/sources/products.index.inc.php, line 347, change the statement from:

if (($uploaded = $filemanager->upload()) !== false) {

to:

if ((is_array($uploaded) && $uploaded = $filemanager->upload()) !== false) {

 

This has been reported on the bug tracker.

Link to comment
Share on other sites

For number 3, in admin, Store Settings, Layout tab, Default RSS URL for Admin Dashboard, compare what you have there with:

http://forums.cubecart.com/rss/forums/1-cubecart-news-announcements/


For number 4, you may have a file with a image-type suffix in the filename, but it is not an actual image, or may be damaged. Please examine all the images in the /images/source folder.

Link to comment
Share on other sites

For number 6, Devellion has said this isn't really a problem and has put fixing this at a low priority. This is my fix:

 

In the file /admin/sources/products.index.inc.php, find near line 1074:

$option_matrix = option_matrix($unique_groups);

Add this line after it:

$smarty_data['option_matrix']['all_possible'] = array();

The above is just a formal matter and doesn't change anything.

 

Then, find near line 1090, this statement that starts with:

$delete_query = "UPDATE `"

Above that line add:

if ($possible) {

and on a line after the $GLOBALS['db'] statement, add a closing brace to close out the conditional.



For number 7, this is strange as line 28 is a blank line.

Link to comment
Share on other sites

Wow - thanks! I've worked through all of your changes above.

 

#1 - Cache.  My only edits to CC code are a custom skin and adding some links to the Admin Navigation and that's about it. I'm also using the Privacy Manager plugin by GWorks (hides prices until you login)

So far no dbg log file created after 5 cache refreshes of the /cache/skins folder. I place the function call like this:

public function tidy() {
if( function_exists('dbg') ) dbg(__METHOD__);
trigger_error('Cleaning cached files...', E_USER_NOTICE);

 

For #3 I had this URL which when tested redirects to the one you posted: http://www.cubecart.com/site/forums/index.php?act=rssout&id=1

Link to comment
Share on other sites

For #3, there might be the case where the request code cannot handle a redirect. So, I suggest using the redirected URL directly.

 

And as for the log file, I am so, so sorry. The name of the file is actually, ini-custom.inc.php.

Link to comment
Share on other sites

That worked!

 

Here's the log:

21:38:32UTC - 06/16/13
0 => /
1 => 66.249.73.111
2 => 


-------------
Cache_Controler::tidy
at 0 index.php (line 13) Index_php5.3_enc_zend.php->require_once('/home/mysite/public_html/index_php5.3_enc_zend.php')
at 1 index_php5.3_enc_zend.php (line 4) Controller.index.inc.php->include('/home/mysite/public_html/controllers/controller.index.inc.php')
at 2 controller.index.inc.php (line 88) Gui->displayCommon()
at 3 gui.class.php (line 284) Gui->_displaySessionBox()
at 4 gui.class.php (line 1136) Class.gui.display_session_box.php->include('/home/mysite/public_html/modules/plugins/GWorks_Privacy_Manager/hooks/class.gui.display_session_box.php')
at 5 class.gui.display_session_box.php (line 1) Class.gui.display_session_box.php(1) : eval()'d code->eval()
at 6 class.gui.display_session_box.php(1) : eval()'d code (line 1) Class.gui.display_session_box.php(1) : eval()'d code(1) : eval()'d code->eval()
at 7 class.gui.display_session_box.php(1) : eval()'d code(1) : eval()'d code (line 1) Class.gui.display_session_box.php(1) : eval()'d code(1) : eval()'d code(1) : eval()'d code->eval()
at 8 class.gui.display_session_box.php(1) : eval()'d code(1) : eval()'d code(1) : eval()'d code (line 24) Cache->tidy()
at 9 cache.class.php (line 134) ->dbg('Cache_Controler::tidy')


-------------
Link to comment
Share on other sites

Ok, it is now plainly evident that the mod is wanting to destroy any and all evidence of any rendered skin that may have at one time contained HTML that showed a price -- by destroying them all.

 

Rather paranoid, I think. And rather unfortunate as having cached, rendered skins is demonstrably beneficial.

 

Your solution is: comment out the trigger_error statement in Cache->tidy().

 

"the issue appears to be all files in  /Cache/Skin are being deleted every 2-3 minutes. That can't be good!"

 

Your site is getting hit every 2-3 minutes??? Either every indexing robot in the world wants to index you each and every hour, or you have a very interesting and worth visiting site!

 

(Be sure to update the bug report!)

Link to comment
Share on other sites

Thanks I was suspecting the Plugin and wow, that's an interesting way to hide prices.

 

Where do I hide the 'trigger_error'?  Cache->tidy  only exists in the log file.

Is it line 133 in cach.class.php > public function tidy() {

 

Mod wise - what we really want is this Approve customers before they can use the site (Wholesale only)

http://cc3.biz/cubecart-mods/cubecart-4-mods/customer-approval-cc4/prod_247.html

Link to comment
Share on other sites

You said wholesale only. CubeCart 5 allows for the creation of "Groups" whereby Customers and Products can join such groups. With a customer and a product in a group, the customer can see custom pricing and tax statuses.

 

I suppose you could set viewable prices that are ridiculously high: $1,000 for a flashlight, but $9.99 for the customer in the group.

Link to comment
Share on other sites

 

Near line 134 in the file /classes/cache/cache.class.php, find and add two slashes:

// trigger_error('Cleaning cached files...', E_USER_NOTICE);

 

Thanks! I was hoping to stop whatever is generating the logs but stopping the logging helps a bit.

You said wholesale only. CubeCart 5 allows for the creation of "Groups" whereby Customers and Products can join such groups. With a customer and a product in a group, the customer can see custom pricing and tax statuses.

 

I suppose you could set viewable prices that are ridiculously high: $1,000 for a flashlight, but $9.99 for the customer in the group.

 

Wholesale only

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...