Page 1 of 7 123 ... LastLast
Results 1 to 10 of 62
  1. #1
    Join Date
    Nov 2007
    Posts
    25
    Plugin Contributions
    0

    Default php 5.4 fatal error, Allowed memory size of 83886080 bytes exhausted

    Hi, I upgraded a server to php 5.4 and I've been getting these php fatal errors ever since.

    09-Apr-2013 05:43:33 America/Denver] PHP Fatal error: Allowed memory size of 83886080 bytes exhausted (tried to allocate 3050946969 bytes) in /home/MYDOMAIN/public_html/store/includes/functions/html_output.php on line 62
    [09-Apr-2013 05:43:33 America/Denver] PHP Warning: require(includes/classes/db/mysql/query_factory.php): failed to open stream: No such file or directory in /home/MYDOMAIN/public_html/store/includes/functions/sessions.php on line 59
    [09-Apr-2013 05:43:33 America/Denver] PHP Fatal error: require(): Failed opening required 'includes/classes/db/mysql/query_factory.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/MYDOMAIN/public_html/store/includes/functions/sessions.php on line 59

    It's in sessions.php where there is no db object defined, so it tries to include the db class. But that is failing. Says it's a bug fix for php 5.2.

    I tracked one occurrence down to a session issue with the authorize.net sim callback. In the header.php for checkout_success, I put a session_write_close() just before the exit and that stopped the fatal error in that situation. But here it is occurring again somewhere else.

    In query_factory, there is a session existing when I log just before the failing include.
    If I change the include to be a full file path, the include of the db class succeeds but it fails saying that class Base doesn't exist, so something is very wrong there. Some chain of includes is failing somehow.

    Any ideas on how to debug this situation? I'll have to find which url is causing this fatal error and try seeing how far it's getting and where it's occurring by using error log statements. I haven't been able to cause it to happen locally, or when a debugger is attached to server. Any ideas?

    Are these includes depending on the current directory set to anything in particular? I'm using php-fpm to run php from apache 2.4.

    thanks much

  2. #2
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: php 5.4 fatal error, query factory

    Sounds exactly like custom code (or an addon with a bug) that's gone into an endless loop while iterating through a set of database results because it's missing the call to MoveNext() within the while() loop.

    The files mentioned are merely messengers; highly unlikely they're the cause of your problem, unless you've altered them from their original contents.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Nov 2007
    Posts
    25
    Plugin Contributions
    0

    Default Re: php 5.4 fatal error, query factory

    Thanks, that helps, I didn't think of that - php is calling the session_write because it's killing a thread that's either timed out or used too many resources. And perhaps many of the classes are garbage at that point, overwritten in memory etc.

    We don't have many customizations but I'll check them all. I don't think it's the database thing or infinite loop or we'd have problems with our store. Our store is running fine except for this random bug that occurs a few times a day. It used to only occur during the authorize.net sim callback, but now I have to track down what's causing it again.

    thanks

  4. #4
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: php 5.4 fatal error, query factory

    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Aug 2009
    Posts
    38
    Plugin Contributions
    0

    Default Re: php 5.4 fatal error, query factory

    Hi, sorry to jump in, but I'm having pretty much the same problem. I'm using Zen Cart version 1.5.1, with PHP 5.2 everything is fine, when I switch to PHP 5.4, everything is still fine apart from:

    When a customer tries to log in (on "main_page=login", enters email address + password + click "log in" button) the screen goes blank. Refresh with F5 and everything is fine, they are logged in and can access orders etc. The only issue is the blank screen, and obviously customers won't know to refresh.

    The log file is pretty much as above: "[09-May-2013 20:19:01 Europe/Berlin] PHP Fatal error: Allowed memory size of 94371840 bytes exhausted (tried to allocate 746615801 bytes) in /homepages/1/d205539884/htdocs/store/includes/functions/html_output.php on line 62".

    Any ideas where to start looking? The customer table in the database is only half a MB which doesn't seem too large, and I don't think there are any mods which would affect this. Also it doesn't happen at all with PHP 5.2.

  6. #6
    Join Date
    Nov 2007
    Posts
    25
    Plugin Contributions
    0

    Default Re: php 5.4 fatal error, query factory

    I had this same Fatal Error show up on a different site with different server, different Cent OS version, and almost no cart customizations. Traced it down to the last redirect in the header.php for the login page. Was able to do a backtrace on an apache segfault core dump and saw a Zend error reading a constant. I wasn't able to debug it more w/o recompiling php with debug symbols etc etc.

    Also, it seemed to depend on cookies - if I had logged in once (refresh after fatal error), then it would logout/login w/o error. But starting w/o cookies seemed to always make it error.

    I was able to duplicate the crash on a virtualbox linux setup too. If I commented the code in login header.php for merging the carts, it segfaulted, if left in it was a Fatal Error. So something was hosed earlier probably. This is w/o any opcode cache. Happens with apache 2.2 and 2.4, one is DSO and one is php-fpm. So I think we have a php error showing up in 5.4.14.

    Went back to php 5.3.23 and all is fine now - no errors at all. That's the only solution I know for now.

    I was using php from the Remi repository for centos/redhat. When there's an update I'll try again.

    here's the call trace from the segfault:
    (gdb) bt
    #0 0x006604f5 in ?? ()
    #1 0x04c34090 in ?? () from /usr/lib/httpd/modules/libphp5.so
    #2 0x04a778ff in _zval_copy_ctor_func (zvalue=0xb75d6e8c) at /usr/src/debug/php-5.4.14/Zend/zend_variables.c:123
    #3 0x04abc2fb in _zval_copy_ctor (execute_data=<value optimized out>)
    at /usr/src/debug/php-5.4.14/Zend/zend_variables.h:45
    #4 ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER (execute_data=<value optimized out>)
    at /usr/src/debug/php-5.4.14/Zend/zend_vm_execute.h:22396
    #5 0x04ae64a6 in execute (op_array=0x1ad3d58) at /usr/src/debug/php-5.4.14/Zend/zend_vm_execute.h:410

  7. #7
    Join Date
    Aug 2009
    Posts
    38
    Plugin Contributions
    0

    Default Re: php 5.4 fatal error, query factory

    Have to admit I'm a novice with this stuff and a lot of it goes over my head. One thing I've noticed which may or may not be relevant - with PHP 5.2, when a customer logs in, the page that loads up is the store home page (unless they have saved cart contents). With PHP 5.4, after the blank screen and refresh, the page that loads is "main_page=account" instead of the store home page.

    Also, I have another site with the same server settings, zen cart 1.5.1 again, more or less the same zen cart settings + mods, but works fine on PHP 5.4. Logging in brings up the store home page on that site.

    I've tried deleting all CUSTOM template files so the defaults were used, still the same problem. I've looked at files in the modules/pages folders for the login + account pages, compared them to the other site which works ok, and there are no differences.

    I'm completely stumped now. I was hoping to switch to PHP 5.4 so I can upgrade to a different hosting package, which doesn't support older versions of PHP. So frustrating as this is the only thing holding me back.
    Last edited by WayneStephens; 10 May 2013 at 10:44 AM.

  8. #8
    Join Date
    Aug 2009
    Posts
    38
    Plugin Contributions
    0

    Default Re: php 5.4 fatal error, query factory

    Just realised my last post was pretty useless, sorry. Login takes the customer back to where they were before, so in my case shop home page. F5 on the blank login screen takes the customer to their account page, as that is what is supposed to happen if someone tries to "log in" while already logged in.

    So the question is, what causes the blank page error after login, even though the login works (they are logged in after F5 refresh)?

  9. #9
    Join Date
    Nov 2007
    Posts
    25
    Plugin Contributions
    0

    Default Re: php 5.4 fatal error, query factory

    you need to check your php error log files and see what they say. with 1.5.1 it's in the logs folder.
    If there's no errors, it may be that apache crashed and that would be in the system error logs - your host should be able to tell you where to find those.

  10. #10
    Join Date
    Aug 2009
    Posts
    38
    Plugin Contributions
    0

    Default Re: php 5.4 fatal error, query factory

    The error log is the same as mentioned in my first post.

    The problem seems to be caused when, after login, the user is redirected back to the page they were on. I've managed to get around it for now by redirecting them to their account page after login, in the block of code that starts with:

    Code:
            if (sizeof($_SESSION['navigation']->snapshot) > 0) {
    Something somewhere seems to be messing up the "snapshot", but I've no idea what could cause that. The website I am having this problem with uses the Zen Lightbox 1.6.4 mod. The other website that doesn't have this problem, doesn't have that mod. I read somewhere that people with that mod sometimes have problems with cookies. Do you by any chance have that lightbox mod installed?
    20th Century Glass - Antique & Collectable Glass Store

 

 
Page 1 of 7 123 ... LastLast

Similar Threads

  1. Replies: 12
    Last Post: 17 Mar 2014, 11:10 PM
  2. Replies: 11
    Last Post: 12 Feb 2013, 10:04 PM
  3. Replies: 4
    Last Post: 22 Jan 2009, 01:14 PM
  4. Allowed memory size of 8388608 bytes exhausted
    By Cornholio in forum General Questions
    Replies: 2
    Last Post: 14 Jun 2007, 03:18 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR