• Hi All,

    I know this is not a new topic and has been answered many times in this forum but I am afraid no one has given an accurate answer except changing the memory limit for wp & php and also disabling the plugins.

    I am running a website and increasing the memory limit for PHP to 512M and WordPress to 128M, hasn’t fixed my issue yet ( however it has dramatically dropped and now I can see only a few times per day).

    My theme is Listify which is using WP Job Manager. It has quite a long list of plugins (almost 25 active plugins) including woocommerce and its extensions. I have disabled the Wordfence, WP Memory Usage and anything else which may have eaten up the memory but no luck.

    Using TPC Memory usage shows only 90M is used and there is no particular plugins in the erros. sometimes Jetpack, sometimes core WP php files etc.

    I have also upgraded the PHP version to the latest 5.4 and WP 4.2.3. Site is running on WHM CPanel.

    I really need to get the ideas of whoever has experienced anything else. Any debugging tool for instant memory monitoring or known conflict between plugins… Just let me know what else you need to know and I am more than happy to provide.

    Any idea is appreciated.

    Thanks
    Ethan

Viewing 15 replies - 1 through 15 (of 19 total)
  • Moderator James Huff

    (@macmanx)

    WordPress on its own can function under 32 MB, so something else is using it up.

    Try deactivating all plugins. If that resolves the issue, reactivate each one individually until you find the cause.

    If that does not resolve the issue, try switching to the Twenty Fifteen theme to rule-out a theme-specific issue (theme functions can interfere like plugins).

    Thread Starter Ethan Ferdosi

    (@rightshifttech)

    James,

    I’ve tried this before. the error happens randomly on different plugins each time. That makes it hard to debug. Also, for the website to function, multiple plugins must be activated at the same time…

    Moderator James Huff

    (@macmanx)

    So, perhaps it’s those plugins then?

    When you tried with all plugins deactivated, did you try with literally *all* plugins deactivated?

    Thread Starter Ethan Ferdosi

    (@rightshifttech)

    Yes, I did.

    Here is the a few lines of log for errors in last couple of hours.

    Do you know anyway that we can monitor real-time memory usage in wordpress, e.g. any plugins or cpanel software etc?

    [29-Jul-2015 22:09:15 UTC] PHP Fatal error: Out of memory (allocated 41680896) (tried to allocate 12160 bytes) in /home/fsuser/public_html/wp-content/plugins/jetpack/modules/sharedaddy/sharing.php on line 359
    [29-Jul-2015 22:09:15 UTC] PHP Fatal error: Out of memory (allocated 14942208) (tried to allocate 49152 bytes) in /home/fsuser/public_html/wp-content/plugins/jetpack/class.jetpack.php on line 2732
    [29-Jul-2015 22:09:15 UTC] PHP Fatal error: Out of memory (allocated 20971520) (tried to allocate 1280 bytes) in /home/fsuser/public_html/wp-content/plugins/woocommerce-subscriptions/classes/class-wc-subscriptions-upgrader.php on line 40
    [29-Jul-2015 22:09:15 UTC] PHP Fatal error: Out of memory (allocated 37486592) (tried to allocate 3072 bytes) in /home/fsuser/public_html/wp-content/plugins/wp-job-manager-wc-paid-listings/includes/class-wc-paid-listings-admin.php on line 16
    [29-Jul-2015 22:09:15 UTC] PHP Fatal error: Out of memory (allocated 13631488) (tried to allocate 12288 bytes) in /home/fsuser/public_html/wp-content/plugins/contact-form-7/includes/contact-form.php on line 442
    [29-Jul-2015 22:09:15 UTC] PHP Fatal error: Out of memory (allocated 25690112) (tried to allocate 3072 bytes) in /home/fsuser/public_html/wp-content/plugins/wordfence/wordfence.php on line 23
    [29-Jul-2015 22:09:15 UTC] PHP Fatal error: Out of memory (allocated 30932992) (tried to allocate 3072 bytes) in /home/fsuser/public_html/wp-content/plugins/wp-job-manager-field-editor/classes/fields.php on line 642
    [29-Jul-2015 22:09:15 UTC] PHP Fatal error: Out of memory (allocated 21233664) (tried to allocate 12288 bytes) in /home/fsuser/public_html/wp-content/plugins/woocommerce-subscriptions/classes/class-wc-subscriptions-upgrader.php on line 55

    Moderator James Huff

    (@macmanx)

    So, judging by this, I think the problem is that the server is actually out of memory itself.

    Note, “(allocated 21233664) (tried to allocate 12288 bytes)”

    So, 21233664 bytes are allocated, and the plugin tripping the error tried to use only 12288 bytes but couldn’t.

    Perhaps there’s another site on the server hogging all of the physical resources.

    I recommend contacting your hosting provider about this.

    Thread Starter Ethan Ferdosi

    (@rightshifttech)

    thanks James. I’ll keep you posted .

    Moderator James Huff

    (@macmanx)

    You’re welcome!

    Yeah, since the allocated values are all different, doesn’t sound like a PHP memory limit as set by memory_limit = 128M or whatever the value is in the PHP.INI.

    Thread Starter Ethan Ferdosi

    (@rightshifttech)

    MarkRH,

    using TPC Memory Usage plugins, it shows:

    WordPress Memory Limit: 256M
    PHP Memory Limit: 512M

    any idea why it is not picking it up?

    Moderator James Huff

    (@macmanx)

    Because there’s no memory left to allocate in the server probably.

    When you’re on a shared server, you’re sharing hardware with at least a thousand sites. Imagine if all of them set their allocation to at least 128 MB, now imagine if ten of then were incredibly popular or doing something memory-intensive. Pretty soon, there’s no physical RAM left.

    In particular, “(allocated 21233664) (tried to allocate 12288 bytes)” translates as “(allocated 21.234 MB) (tried to allocate 0.012 MB)”. Sure seems pretty dire, so it will be interesting to see what your hosting provider says.

    Thread Starter Ethan Ferdosi

    (@rightshifttech)

    Just an update on response from hosting provide:

    I talked to them and they confirmed that all 512M is fully assigned to the site and is not shared with any other site on the WHM.

    Also, the guy pointed to the fact that for the log entries happening on the same time/date, the total amount of memory is the sum of all consecutive calls which exceed the 128M. I am not sure though about his opinion but couldn’t find a source on the net to confirm it and like to hear your points.

    And finally, I stopped Wordfence & Scheduled back up since writing this post and hasn’t seen any error. Memory usage is showing 59M in its max reach.

    Also this is another link talking about the same issue and recommending disabling GC. any thoughts?

    Moderator James Huff

    (@macmanx)

    Hm, he could be right about all of those little bits bursting the memory at the same time and hitting the limit.

    Are you saying you aren’t having the problem now?

    Thread Starter Ethan Ferdosi

    (@rightshifttech)

    Nothing for last 10 hours. But definitely I need to set the scheduled backup & wordfence back up and see if the issue returns.

    Moderator James Huff

    (@macmanx)

    Excellent, fingers crossed that it was only a temporary issue.

    I added the following to my theme’s functions.php file:

    ###########################################################################################
    function memory_stats()
    { // BEGIN function memory_stats
       if ($_SERVER['REMOTE_ADDR'] == HOME_IP) {
          echo '<p style="clear: both;">Memory used: '. number_format(memory_get_usage(true)). ' bytes.<br />';
          echo 'Peak Memory used: '. number_format(memory_get_peak_usage(true)).' bytes.</p>';
       }
    
    } // END function memory_stats
    
    add_action('in_admin_footer', 'memory_stats');

    You can also call memory_stats() at the bottom of the theme’s footer.php file.

    It’ll tell you what it’s thinking anyway. Oh, I define HOME_IP at the top of my theme’s functions.php. You can get rid of the if statement if needed.

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Fatal Memory Issue’ is closed to new replies.