Support » Plugin: Wordfence Security - Firewall & Malware Scan » Fatal error: Allowed memory size exhausted

  • Hi,

    I’m getting this blocking error when scanning, after fetching the list of themes etc. :
    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 19766805 bytes) in /home/XXXX/domains/YYYY/public_html/wp-includes/wp-db.php on line 1262

    It’is the first time I see this error, it has always worked previously on this server with WF version < 6.1.2

    https://wordpress.org/plugins/wordfence/

Viewing 9 replies - 1 through 9 (of 9 total)
  • I too am getting a “memory size exhausted” failure message. Scans will not complete. I posted in this support group as well.

    Plugin Author WFMattR

    (@wfmattr)

    Hi webby1973,

    This is probably because some of the scan data is larger than in previous versions, so combined with other plugins’ memory usage, the site is reaching the limit. You may be able to increase “How much memory should Wordfence request when scanning” on the Wordfence options page, if it is currently set to 128 MB. (Try 256, if it’s not already set that high.)

    If this does not help, you may need to ask the host to increase the “memory_limit” in the php.ini file for you. If you have any plugins you’re no longer using, sometimes disabling/removing them will also help decrease memory usage during scans, but you might hit the limit again soon. We will be working on decreasing memory usage where possible as well.

    -Matt R

    Hello Matt,

    I have set in WF memory to 128MB (which is what my host allows) and 30 for the execution time.
    It doesn’t work:
    [Apr 27 02:12:37] Fetching list of known malware files from Wordfence
    Success.
    [Apr 27 02:12:39] Comparing core WordPress files against originals in repository
    …. STOP

    Warning: mysqli_query(): MySQL server has gone away in /home/XXX/domains/YYY/public_html/wp-includes/wp-db.php on line 1811 Warning: mysqli_query(): Error reading result set’s header in /home/XXX/domains/YYY/public_html/wp-includes/wp-db.php on line 1811 Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 13940485 bytes) in /home/XXX/domains/YYY/public_html/wp-includes/wp-db.php on line 1263

    I can’t raise the memory on this shared server, but the previous versions of WF worked.

    Hi,
    I’m also getting the same error message when I try and initiate a scan:
    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes) in /home/tradin0/public_html/wp-content/plugins/wordfence/lib/wordfenceHash.php on line 85

    I’ve set my WP memory to 128mb in wp-config.php. I’ve also set “How much memory should Wordfence request when scanning” to 128mb within the WF Options page. I’ve also played around with the “Update interval in seconds” as suggested in other topics raised (but unresolved) as a solution for this issue. phpinfo() returns 128M as memory_limit and 30 as max_execution_time.

    When running WF Memory Diagnostics, I get the following output:
    Congratulations, your web host allows you to use at least 91.00 megabytes of memory for each PHP process hosting your WordPress site.

    Are there issues now using WordFence with the lower-end Shared-Hosting solutions, and is this a product geared now for VPS, Cloud and Dedicated hosting? Would purchasing the premium version of WF possibly resolve this issue?

    IMHO, WordPress itself is geared towards VPS and dedicated hosting, not to mention any plugin worth being used needs server resources. That is unless your website has no readers and you’ve got 70 hours a week to make it work anyway… MTN

    Further info on my problem…
    I have enabled the WF debugging mode and get the following output:
    [Jul 25 08:09:02] Calling Wordfence API v2.22:https://noc1.wordfence.com//v2.22/?v=4.5.3&s=http%3A%2F%2Fwww.thetradingco.co.za&k=ddc02f1050b4645f56afab4b5686b8a4b4919229a7f0d0eab06a5a4803e8847ea51620682a2778bcc2b44a6151c5d7033dedf7fb358e8f67bdc6428dfd33883651e614ee890350ea76b4810754d5b1137fc68eb5b0f0419adce8e2a4e3e7ceeb&openssl=9469999&phpv=5.3.29&betaFeed=0&cacheType=&action=get_known_files
    [Jul 25 08:09:07] Calling Wordfence API v2.22:https://noc1.wordfence.com//malwarePrefixes.bin
    [Jul 25 08:09:10] Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes) in /home/tradin0/public_html/wp-content/plugins/wordfence/lib/wordfenceHash.php on line 85

    I then disabled WF SSL Verification, thinking it was a connectivity issue, but still no joy.

    I have also disabled the High Sensitivity and Image scans.

    What worked for me. I changed the allowed memory size to 64 from 32mb. Then went to the Scan page and clicked “click to kill the current scan.” Option. I then went on to clear my cache (I use Comet Cache). Thereafter I went back to scan. The scanning finished without issues. Hope this helps someone.

    I have wordfence running on a number of sites. On only one of them I am having this problem. I did an number of tests to try to find out what was happening – (not super techie by the way) and the only thing that has worked so far is to uncheck ‘scan for signatures of known malicious files’.
    When I ran a scan with that unchecked all was well – and the result at the end stated ‘Wordfence used 23.72MB of memory for scan. Server peak memory usage was: 74.82MB’.

    On all my other sites I am able to run the scan with this checked.
    I have also inactivated all of my plugins – no change – only the unchecking of malicious files worked. Does anyone have any possible explanation for this please?

    Here is some more information that may be helpful –
    when I tested the amount of memory allowed by the host this was the result:

    Wordfence Memory benchmarking utility version 6.1.14.
    This utility tests if your WordPress host respects the maximum memory configured
    in their php.ini file, or if they are using other methods to limit your access to memory.

    –Starting test–
    Current maximum memory configured in php.ini: 128M
    Current memory usage: 41.00M
    Setting max memory to 90M.
    Starting memory benchmark. Seeing an error after this line is not unusual. Read the error carefully
    to determine how much memory your host allows. We have requested 90 megabytes.
    Completing test after benchmarking up to 80.25 megabytes.
    –Test complete.–

    Congratulations, your web host allows you to use at least 80.25 megabytes of memory for each PHP process hosting your WordPress site.

    and this is the error information from activity log:

    [Aug 17 17:19:29:1471425569.029394:1:error]
    <b>Fatal error</b>: Allowed memory size of 134217728 bytes exhausted (tried to allocate 15115177 bytes) in <b>/home/thecorp1/public_html/wp-includes/wp-db.php</b> on line <b>1292</b>

    thank you.

    Bunty

    (@bhargavbhandari90)

    add this to wp-config.php

    define('WP_MEMORY_LIMIT', '128M'); or try with different memory size like
    define('WP_MEMORY_LIMIT', '256M'); or
    define('WP_MEMORY_LIMIT', '512M'); or

    • This reply was modified 1 year, 8 months ago by  Bunty.
    • This reply was modified 1 year, 8 months ago by  Bunty. Reason: improvization
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Fatal error: Allowed memory size exhausted’ is closed to new replies.