• Resolved aenea

    (@aenea)


    At some point in the last week, my test website https://test.sustainability-in-practice.org.uk has started giving a memory size exhausted error message, e.g.

    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /var/sites/t/test.sustainability-in-practice.org.uk/public_html/wp-includes/wp-db.php on line 1972

    After a bit of troubleshooting, I discovered that the error goes away if I deactivate Wordfence and returns when I reactivate the plugin. So it would appear that the error is related to the running of Wordfence in some way.

    A few weeks ago the site was hacked but it has since been restored to a pre-hack version and all hacker-created files and directories deleted and the site now passes Wordfence and Succuri integrity tests. However, bots keep trying to access files that were put on the site during the hack. I have configured the Wordfence Firewall to block all IP addresses that try to access the now non-existent directories and hoped that, after a while, the traffic would die down. However the attempts keep coming – more than 26,000 blocks of USA IP addresses in the last 7 days, almost 5,000 blocks from UK, 1500 from Canada, 1000 from India and so on.

    I am, therefore, wondering if it the blocking of all this traffic that is causing the memory problem. The live site https://sustainability-in-practice.org.uk/ which has a more or less identical installation of plugins has no memory problem. This site wasn’t hacked and the Wordfence Firewall reports only a very small number of blocks.

    Can anyone suggest a solution to this problem? I don’t want to risk leaving the test website without Wordfence protection.

    [Adding ‘WP_MEMORY_LIMIT’ to the wp-config.php file has no effect but the Wordfence memory check confirms that ‘your web host allows you to use at least 256.00 megabytes of memory for each PHP process hosting your WordPress site.’]

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support wfphil

    (@wfphil)

    Hi @aenea

    I see from the PHP fatal error that your hosting provider has set the memory_limit PHP directive on the server to a value of 128M (128 megabytes)

    WordPress, your active theme and active plugins all consume memory. The combined memory consumption has exceeded the amount allowed by your hosting provider.

    You can ask them if they can upgrade the memory_limit PHP directive to a value of 256M.

    Thread Starter aenea

    (@aenea)

    I don’t really want to do that. The live web site is working fine within that memory limit and the test website has only just started giving this error message. So I would prefer to get to the bottom of why the test website is now encountering this error.

    As I mentioned in my original post, the error goes away when I deactivate Wordfence so it would appear that it is related to Wordfence – most likely the Firewall IP blocking activity since this is a new feature on the test website and is not shared by the live website.

    So, I was hoping that someone might be able to explain why this is happening and provide me with a workaround to reduce the memory usage.

    Plugin Support wfphil

    (@wfphil)

    Hi @aenea

    The error is not related to Wordfence. You can see in the error that a WordPress file is triggering the error:

    /var/sites/t/test.sustainability-in-practice.org.uk/public_html/wp-includes/wp-db.php on line 1972

    WordPress, your theme and all active plugins are consuming more memory than is allowed as per the memory_limit PHP directive set on the hosting server.

    Deactivating Wordfence simply reduced the overall memory consumption.

    If the server allows it then in the test site installation you can add this line to either a php.ini, .user.ini or .htaccess file depending on your server environment:

    memory_limit = 256M

    • This reply was modified 5 years, 5 months ago by wfphil.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Wordfence causing memory size exhausted error’ is closed to new replies.