Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2005
    Posts
    22
    Plugin Contributions
    0

    Default myDEBUG log files hit inode limit

    After a lot of functionality on our client's website stopped working yesterday, we learned that the server hit the inode limit due to a huge number of log files being written to the /logs directory. They're all in the format myDEBUG-*.log, and contain basically the same message pasted below. The hosting provider deleted them, but there are hundreds of new ones being generated per minute.

    Any ideas on what is causing these warnings? I assume something is being passed into the foreach that is not an array. Also, is there a way to disable writing log files on a PHP Warning severity level?

    Zen Cart v1.5.5a

    Thanks!

    Code:
    [27-Apr-2017 13:33:57 America/Phoenix] Request URI: /index.php?main_page=product_info&cPath=&products_id=555, IP address: XXXXXXXXXX
    #1  base->attach() called at [/home/XXXXXXXX/public_html/includes/classes/observers/class.google_recaptcha.php:24]
    #2  google_recaptcha->__construct() called at [/home/XXXXXXXX/public_html/includes/autoload_func.php:79]
    #3  require(/home/XXXXXXXX/public_html/includes/autoload_func.php) called at [/home/XXXXXXXX/public_html/includes/application_top.php:170]
    #4  require(/home/XXXXXXXX/public_html/includes/application_top.php) called at [/home/XXXXXXXX/public_html/index.php:26]
    
    [27-Apr-2017 13:33:57 America/Phoenix] PHP Warning:  Invalid argument supplied for foreach() in /home/XXXXXXXX/public_html/includes/classes/class.base.php on line 30

  2. #2
    Join Date
    Oct 2006
    Location
    Alberta, Canada
    Posts
    4,571
    Plugin Contributions
    1

    Default Re: myDEBUG log files hit inode limit

    Could be the site is under some sort of attack. I would disable the CAPTCHA to see if that helps. Check your Apache error log as well to see if that sheds any light on things.

    If not, then I would suggest to put the site into Maintenance mode, then delete all error logs. Then see if new debug files are being generated by Search Engine Bots and if so, what exactly they are. You should then also do some testing yourself to see if you can duplicate the errors.

  3. #3
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: myDEBUG log files hit inode limit

    What are the contents of: includes/classes/observers/class.google_recaptcha.php?

    As far as disabling all warning messages, yes you can, but it is not advisable per se. Instead that issue should be resolved.

    Said that they were all pretty much the same, was/is it that everything from #2 and down has been the same or are different notifiers at play?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    Join Date
    Jun 2005
    Posts
    22
    Plugin Contributions
    0

    Default Re: myDEBUG log files hit inode limit

    Quote Originally Posted by mc12345678 View Post
    What are the contents of: includes/classes/observers/class.google_recaptcha.php?

    As far as disabling all warning messages, yes you can, but it is not advisable per se. Instead that issue should be resolved.

    Said that they were all pretty much the same, was/is it that everything from #2 and down has been the same or are different notifiers at play?
    Correct, everything from line 2 on down is the same except for the timestamps. There seems to be a wide variety of IP addresses, so it might be normal website traffic that is triggering something on every page hit. My previous estimate of "hundreds per minute" turned out to be a bit high.

    Here are the contents of class.google_recaptcha.php - I believe we were having some trouble getting CAPTCHA working in v1.5.5, so I removed it from the pages. There might still be some hooks to it, though.

    Code:
    <?php
    /**
    *
    * @package plugins
    * @copyright Copyright 2003-2012 Zen Cart Development Team
    * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
    *
    * Designed for v1.5.4
    * Observer class for Google reCaptcha
    */
    
    class google_recaptcha extends base {
    	/**
    	 * @var array
    	 */
    	private $pages_to_checkcheck = array();
    
    	function __construct() {
    
    		//comment out any pages you do NOT want to check
    		//$pages_to_check[] =  'NOTIFY_CONTACT_US_CAPTCHA_CHECK';
    		//$pages_to_check[] =  'NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK';
    		//$pages_to_check[] =  'NOTIFY_REVIEWS_WRITE_CAPTCHA_CHECK';
    		$this->attach($this,$pages_to_check);
    	}
    
    	function update(&$class, $eventID, $paramsArray = array()) {
    		global $messageStack, $error, $privatekey;
    
    		require_once __DIR__ . '/google/autoload.php';
    		$recaptcha = new \ReCaptcha\ReCaptcha($privatekey);
    		// If file_get_contents() is locked down on your PHP installation to disallow
    		// its use with URLs, then you can use the alternative request method instead.
    		// This makes use of fsockopen() instead.
    		//$recaptcha = new \ReCaptcha\ReCaptcha($privatekey, new \ReCaptcha\RequestMethod\SocketPost());
    		// This makes use of curl instead
    		//$recaptcha = new \ReCaptcha\ReCaptcha($privatekey, new \ReCaptcha\RequestMethod\Curl());
    
    		$resp = $recaptcha->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']);
    
    		if (!$resp->isSuccess()) {
    			$event_array = array('NOTIFY_CONTACT_US_CAPTCHA_CHECK' => 'contact', 'NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK' => 'create_account', 'NOTIFY_REVIEWS_WRITE_CAPTCHA_CHECK' => 'review_text');
    			$messageStack->add($event_array[$eventID], $resp->getErrors());
    			$error = true;
    		}
    		return $error;
    	}
    }

  5. #5
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: myDEBUG log files hit inode limit

    So, while it appears that the instructions may have been followed about commenting out the pages on which it is not to be used, but the intention is that it would still be used otherwise all of the modifications made for the plugin to operate should be removed from the server. (generally speaking there should be removal/uninstall instructions or in a way reversing the installation process should do it as well.) Basically, another thing is that $pages_to_check was never initialized so with all occurrences commented out it isn't treated as a blank array which a foreach statement can handle.If the file is to remain on the server, may I suggest that the line before the first commented out page that the following be added?
    Code:
    $pages_to_check = array();
    Be advised that removal of just this file and nothing else will also cause an error to be logged most likely because there is another file likely in the includes/auto_loaders directory that is requiring this file to be loaded (and if not require then include and I wouldn't be surprised if the absence of the file to include wouldn't generate a warning as well). Anyways, I digress. Suggestion is 1) to add the appropriate line from above to the file to stop the bleeding, then 2) seek out the proper way to remove the plugin if it is not to be used. Extra software leads to additional potential issues.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Jun 2005
    Posts
    22
    Plugin Contributions
    0

    Default Re: myDEBUG log files hit inode limit

    Quote Originally Posted by mc12345678 View Post
    Suggestion is 1) to add the appropriate line from above to the file to stop the bleeding, then 2) seek out the proper way to remove the plugin if it is not to be used. Extra software leads to additional potential issues.
    Thank you! The wound has been cauterized. No error log files for the past few minutes.

    I had assumed that the line

    private $pages_to_checkcheck = array();

    just above the constructor would have initialized the array, but apparently it was in a different scope.

    Anyway, I will continue with a full removal of the plugin. Thanks again.

  7. #7
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: myDEBUG log files hit inode limit

    Quote Originally Posted by d9000 View Post
    Thank you! The wound has been cauterized. No error log files for the past few minutes.

    I had assumed that the line

    private $pages_to_checkcheck = array();

    just above the constructor would have initialized the array, but apparently it was in a different scope.

    Anyway, I will continue with a full removal of the plugin. Thanks again.
    It would have if everywhere else it was used that it was referenced as: $this->pages_to_check.

    Glad that part of the surgery is complete. Good luck with the rest. Remember to backup frequently.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. v153 myDEBUG: 3 identical files yesterday
    By RixStix in forum General Questions
    Replies: 3
    Last Post: 27 Feb 2015, 07:05 PM
  2. v153 Multiple myDEBUG files, similar errors
    By RixStix in forum Bug Reports
    Replies: 26
    Last Post: 21 Aug 2014, 08:22 AM
  3. Replies: 4
    Last Post: 19 Jan 2013, 05:47 AM
  4. Thousands of MyDebug files!
    By jgold723 in forum General Questions
    Replies: 7
    Last Post: 22 Nov 2011, 09:21 PM
  5. myDEBUG log files in cache folder
    By Athens Collectibles in forum General Questions
    Replies: 2
    Last Post: 26 Jun 2011, 11:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg