madfitz

  • Elite Class Non Coder
  • Posts: 97
Exhausted memory?
« on March 1st, 2014, 03:14 PM »
I appreciate some of this might be fixed now (based on dates) but I have these errors over the last two days:

[28-Feb-2014 21:16:17 Europe/London] PHP Fatal error:  Maximum execution time of 30 seconds exceeded in /.../gz/app/Class-DB.php on line 636
[28-Feb-2014 21:16:23 Europe/London] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes) in /.../gz/app/Class-DB.php on line 636
[01-Mar-2014 05:15:16 Europe/London] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 31015 bytes) in /.../gz/app/Subs-Template.php on line 1117

Nao

  • Dadman with a boy
  • Posts: 16,079
Re: Exhausted memory?
« Reply #1, on March 1st, 2014, 03:27 PM »
Is it always the same files and lines..?
Because these aren't too helpful to reproduce. The first is actually triggered when asking php to return the list of all functions called so far after an error happened. Perhaps an infinite loop of nested calls. I guess without xdebug it's hard to pinpoint what happened.
The second is triggered by loading a HTML template. There's no reason for it to crash... unless you changed the file somehow...?

madfitz

  • Elite Class Non Coder
  • Posts: 97
Re: Exhausted memory?
« Reply #2, on March 1st, 2014, 10:36 PM »
I just took another look. Those are the entire contents of the error log (I had deleted the log after the previous errors had been fixed), and nothing has been added after that last error.

If it reoccurs I'll let you know.

I can confirm that I have not edited/changed any files. Everything is original.

Nao

  • Dadman with a boy
  • Posts: 16,079
Re: Exhausted memory?
« Reply #3, on March 2nd, 2014, 12:09 AM »
I'm looking into the Class-DB issue... If anything.

Can you tell me if debug is enabled on your forum? i.e., the footer area, does it show you debug statistics?
Re: Exhausted memory?
« Reply #4, on March 2nd, 2014, 12:34 AM »
Also please install latest Class-DB + Errors update, and tell me if it helps with reducing the amount of errors! (If it ever occurs again, of course.)

madfitz

  • Elite Class Non Coder
  • Posts: 97
Re: Exhausted memory?
« Reply #5, on March 2nd, 2014, 12:23 PM »
Debug is not enabled (would you advise I enable it - and how would I do that?)

I have installed the latest files and, so far, see no new errors.

Nao

  • Dadman with a boy
  • Posts: 16,079
Re: Exhausted memory?
« Reply #6, on March 2nd, 2014, 01:03 PM »
I'd advise enabling it as a beta tester... And you are, technically ;)
But more importantly --> Admin > Server > Debugging > Enable query logging.
This is a must have for debugging.

madfitz

  • Elite Class Non Coder
  • Posts: 97
Re: Exhausted memory?
« Reply #8, on March 3rd, 2014, 05:06 PM »
We have new log entries today:

[03-Mar-2014 12:31:36] PHP Fatal error:  Maximum execution time of 30 seconds exceeded in /.../gz/app/Class-DB.php on line 636
[03-Mar-2014 12:31:43] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 523800 bytes) in /.../gz/app/Class-DB.php on line 228
[03-Mar-2014 12:32:25] PHP Fatal error:  Maximum execution time of 30 seconds exceeded in /.../gz/app/Class-DB.php on line 0
[03-Mar-2014 12:32:32] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 523800 bytes) in /.../gz/app/Class-DB.php on line 228

Nao

  • Dadman with a boy
  • Posts: 16,079
Re: Exhausted memory?
« Reply #9, on March 3rd, 2014, 05:18 PM »
Grmpf...

Okay, are you on PHP 5.4 or better? If yes, you could help with debugging this.
Replace line 636 in /core/app/Class-DB.php with:

Code: [Select]
$trace_log = debug_backtrace(!function_exists('version_compare') || (version_compare('5.3.6', PHP_VERSION) > 0) ? false : DEBUG_BACKTRACE_IGNORE_ARGS, 5);

The only difference is the ", 5" added at the end.
This will set a hard limit on the number of objects returned by debug_backtrace() to 5, which should be enough. This should help your code execute. And by code, I mean "error reporting path". Which means after doing this, you'll see errors show up in your Wedge error log, rather than Apache error log.
At that point, you should be able to see what queries are generating errors for you.

Make sure to enable Query Logging in Admin settings > Admin > Server > Debugging (or Error Log Settings), as I said yesterday.
Keep me posted!

madfitz

  • Elite Class Non Coder
  • Posts: 97
Re: Exhausted memory?
« Reply #10, on March 3rd, 2014, 07:10 PM »
The bad news is I'm on PHP 5.3.28

I'm surprised at that because my host is *usually* on top of stuff like that.

EDIT: They updated in August 2013 but just reading something on my hosts boards... looks like I need to request the update.
Re: Exhausted memory?
« Reply #11, on March 3rd, 2014, 07:28 PM »Last edited on March 3rd, 2014, 07:45 PM
Little help please... my hosts site says:
Quote
We provide you the control and option of enabling PHP 5.5 or 5.4 on your entire account or on a per-directory basis through a simple .htaccess modification. This modification can be placed in an accounts public_html/.htaccess file to enable PHP 5.5 or 5.4 for an entire account or in the .htaccess file of a specific directory to enable PHP 5.5 or 5.4 under that directory tree only.
To enable PHP 5.5 or 5.4, you must add one of the following htaccess option:


AddType application/x-httpd-php55 .php
Or
AddType application/x-httpd-php54 .php

The binary path to the PHP 5.5 and 5.4 installations, should you require it for executable php scripts or cronjobs, is located at:


/usr/local/php55/bin/php
And
/usr/local/php54/bin/php
I tried adding this line to htaccess:

AddType application/x-httpd-php54 .php

but everything breaks (500 internal server error).

What am I doing wrong?

EDIT: Going one step further, there is a "PHP Selector" in cPanel. Still breaking things when using the simple drop-down menu on there too :hmm:

Nao

  • Dadman with a boy
  • Posts: 16,079
Re: Exhausted memory?
« Reply #12, on March 3rd, 2014, 08:26 PM »
Hmm... I'm reaching my limits, here. (As well as debug_backtrace's :P)
So, how can we do that... Do these PHP errors show up regularly? A lot? When did they start? Can you point out a single IP address generating them? Where does this log come from, do you have access to your Apache log? Can you match the times between the PHP and Apache logs, and determine what URLs are called that generate the errors?

Pandos

  • Living on the edge of Wedge
  • Posts: 635
Re: Exhausted memory?
« Reply #13, on March 3rd, 2014, 08:36 PM »
Can you please try the following?
Add in index.php direct after the opening tag:
Code: [Select]
ini_set('memory_limit', '-1');

It's a workaround, but no solution for your problem.
# dpkg-reconfigure brain
error: brain is not installed or configured

madfitz

  • Elite Class Non Coder
  • Posts: 97
Re: Exhausted memory?
« Reply #14, on March 3rd, 2014, 11:33 PM »
Nao, the answer to most of that is "no" (as I barely understood most of it!)

These errors can be found in the error.log file in the forum root folder. The errors don't happen often (something like once on Feb 28, twice on March 1 and three times on March 3).

I've scoured the various error logs in my cPanel but there's nothing that makes sense to me - and nothing obvious that ties in with the error times/dates.

I'm surprised that (so far) I seem to be the only one with these specific errors.

Pandos, I've added that line.

I'll let you all know if I see anymore 'exhausted memory' errors.