Title: Scans never complete &#8211; memory and timeout errors
Last modified: April 26, 2018

---

# Scans never complete – memory and timeout errors

 *  [djvenja](https://wordpress.org/support/users/djvenja/)
 * (@djvenja)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/scans-never-complete-memory-and-timeout-errors/)
 * I’m really struggling to get scans to complete and have seemingly exhausted all
   options. My current WordPress / PHP config is below:
 * WordPress 4.9.5
    PHP 7.0.29 memory_limit 512M max_execution_time 120 post_max_size
   256M
 * In light of the problems I’ve been facing, I currently have the below WordFence
   settings applied:
 * Scan Type: Limited Scan
    Use low resource scanning: Enabled Time limit that a
   scan can run in seconds: blank / default How much memory should Wordfence request
   when scanning: 256M Maximum execution time for each scan stage: 96 Enable SSL
   Verification: Disabled
 * I also have a plugin installed that displays current memory in use by the site,
   which settles down at around 46MB (9%). The memory available to the WordPress
   installation is 512MB – it was upgraded to this level by my host after requesting
   additional resources. They have told me that this is the maximum level that they
   can increase it to.
 * Even with the above settings configured as they are (based on WordFence support
   article / forum advice, I still can’t seem to get a scan to complete. At the 
   same stage each time (“Analyzed 7317 files containing 108.58 MB of data.”), I
   receive one of two errors:
 * `Fatal error: Out of memory (allocated 60817408) (tried to allocate 1056768 bytes)
   in /path/to/file/cURL.php on line 484`
 * or
 * `Scan terminated with error: There was an error connecting to the Wordfence scanning
   servers: cURL error 28: connect() timed out!`
 * I’m at a loss with what to do next. It seems I have sufficient memory available
   and configured appropriately, but the scans always fail. I’m close to throwing
   in the towel and trying All In One WP Security and Firewall instead, but I don’t
   really want to have to do this as I really like WordFence. Any advice would be
   very much appreciated.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fscans-never-complete-memory-and-timeout-errors%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 12 replies - 1 through 12 (of 12 total)

 *  [andfos](https://wordpress.org/support/users/andfos/)
 * (@andfos)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/scans-never-complete-memory-and-timeout-errors/#post-10223263)
 * I am getting exactly the same issue.
    The scan always worked. The problems started
   an hour ago. Maybe a problem with the wordfence servers?
 * I already contacted my web server provider and the told me the problem would 
   possibly on Wordfences end:
    “Logs shows we successfully connected to Wordfence
   API – though, the error shows it is timing out. Could be that Wordfence have 
   rate limited the domain connection to their servers. Most likely because you 
   are using a free account ? (just not sure) Much better if you can relay this 
   concern to wordfence support.”
    -  This reply was modified 7 years, 11 months ago by [andfos](https://wordpress.org/support/users/andfos/).
 *  Thread Starter [djvenja](https://wordpress.org/support/users/djvenja/)
 * (@djvenja)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/scans-never-complete-memory-and-timeout-errors/#post-10224034)
 * Have run another scan this morning which has failed without any specific error,
   except for:
 * _“Scan Failed
    The current scan looks like it has failed. Its last status update
   was 14 mins ago. You may continue to wait in case it resumes or stop and restart
   the scan. Some sites may need adjustments to run scans reliably.”
 * Have checked the full log, but this also shows no further errors. It stopped 
   mid-analysis this time:
 * `[Apr 27 08:45:52:1524815152.772402:2:info] Analyzed 4100 files containing 71.29
   MB of data so far`
 *  [mishash](https://wordpress.org/support/users/mishash/)
 * (@mishash)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/scans-never-complete-memory-and-timeout-errors/#post-10225340)
 * Have a look at this thread: [https://wordpress.org/support/topic/memory-allocation-errors-in-error-log/](https://wordpress.org/support/topic/memory-allocation-errors-in-error-log/)
 *  [andfos](https://wordpress.org/support/users/andfos/)
 * (@andfos)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/scans-never-complete-memory-and-timeout-errors/#post-10225766)
 * Hello Mishash,
 * Thank you for your reply.
    Unfortionally after following the article, I still
   can’t seem to get Wordfence working again. I updated the memory etc.
 * Unfortionally I only have 500+ MB RAM Memory that I can dedicate to Wordfence.
 * Did something change since the last update to Wordfence?
    I personally updated
   the plugin yesterday, from that moment the scans won’t work anymore.
 * [@djvenja](https://wordpress.org/support/users/djvenja/) Could you manage to 
   get Wordfence working again?
 *  Thread Starter [djvenja](https://wordpress.org/support/users/djvenja/)
 * (@djvenja)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/scans-never-complete-memory-and-timeout-errors/#post-10230533)
 * [@mishash](https://wordpress.org/support/users/mishash/) – no, I still can’t 
   scan. I’m not getting any more memory errors, just timeouts now. Have enabled
   debugging, but I’m not really getting any extra info (as far as I can see). With
   debugging enabled, the last scan timed out with the following info:
 * [Apr 29 23:36:11:1525041371.976361:4:info] Scanning: /path/to/file/wp-content/
   plugins/updraftplus/methods/ftp.php (Mem:52.0M)[Apr 29 23:36:12:1525041372.000090:
   4:info] Calling fork() from wordfenceHash with maxExecTime: 96
    [Apr 29 23:36:
   12:1525041372.000872:4:info] Entered fork()
 *  Thread Starter [djvenja](https://wordpress.org/support/users/djvenja/)
 * (@djvenja)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/scans-never-complete-memory-and-timeout-errors/#post-10230559)
 * I’ve updated four plugins and now I’m getting memory errors again, quite early
   in the process now (around about 4700 files into analysis). I’m going to give
   this a few more days while I await further support and will replace WordFence
   with a different security plugin if I am unable to overcome these errors by Wednesday.
 *  Thread Starter [djvenja](https://wordpress.org/support/users/djvenja/)
 * (@djvenja)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/scans-never-complete-memory-and-timeout-errors/#post-10234066)
 * I’ve finally got a scan to complete. I discovered the WordFence memory testing
   tool on the Tools > Diagnostics tab. The tests show I can only request up to 
   70MB of memory, after which the tests fail. This is unusual as the System Config
   page (also accessed via the Diagnostics tab) and my memory status plugin both
   show that the Server and WordPress have 512MB available (I have defined the WordPress
   level in the wp-config file), so not sure where and why memory is being limited
 * Event though scans are now completing, I’ve had to further tone down the scan
   options otherwise the scan always times out (no more memory errors, though). 
   I have set “How much memory should Wordfence request when scanning” to 25MB and
   have unchecked both “Scan file contents for backdoors, trojans and suspicious
   code” and “Scan file contents for malicious URLs”. Re-enabling either of these
   options causes the scan to time out again, even if the memory made available 
   is increased to 60MB/70MB.
 * This isn’t ideal, but it’s better than no scan completing at all. I’ve no idea
   why memory is being limited to around 70MB as all settings and performance checks
   suggest that 512MB is available – can anyone suggest why I’m seeing memory tests
   fail at such a low level, yet all figures point to 512MB being avaiable?
 *  [wfalaa](https://wordpress.org/support/users/wfalaa/)
 * (@wfalaa)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/scans-never-complete-memory-and-timeout-errors/#post-10238998)
 * Hi [@djvenja](https://wordpress.org/support/users/djvenja/)
 * It’s recommended to assign “256” MB in “[How much memory should Wordfence request when scanning](https://www.wordfence.com/help/scan/options/#max-memory)“,
   Wordfence will not use all this amount, it will just ask PHP to increase the 
   memory limit to whatever you specify so that in case Wordfence does use that 
   amount of memory, PHP will only throw an error if the new maximum you have requested
   is reached. Setting this value to “25” MB is considered very low for regular 
   sites.
 * Are you sill having the cURL error?
 * Thanks.
 *  Thread Starter [djvenja](https://wordpress.org/support/users/djvenja/)
 * (@djvenja)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/scans-never-complete-memory-and-timeout-errors/#post-10239152)
 * Hi [@wfalaa](https://wordpress.org/support/users/wfalaa/)
 * Thanks for getting back to me. As mentioned in my last post, there is some confusion
   over the amount of memory available to WordPress as I seem to be seeing conflicting
   information. My host (123-Reg) have confirmed that they have assigned 512MB to
   my hosting platform, I have defined 512MB in wp-config.php, and this figure is
   reflected in my memory status plugin (which shows “Server: 512MB, WordPress: 
   512MB”) and any server status / PHP info pages and plugins.
 * However, when I set the memory available to WordFence to anything higher than
   around 70MB, the WordFence memory test always fails with a memory error. With
   the memory set at 70MB or less, the test will pass and my scan will complete,
   but only with both “Scan file contents for backdoors, trojans and suspicious 
   code” and “Scan file contents for malicious URLs” disabled.
 * If I run a scan with a value higher than 70MB (I have mainly used values between
   250-350MB, the scan will always fail, either with a timeout or memory error.
 * The main problem here seems to be how much memory WordFence believes is assigned
   to WordPress. All plugins and status pages state that there is 512MB available
   to the server (with around 9% / 49MB in use under normal circumstances), but 
   the WordFence memory test will fail if more than 70MB is set against “How much
   memory should Wordfence request when scanning”.
 *  [wfalaa](https://wordpress.org/support/users/wfalaa/)
 * (@wfalaa)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/scans-never-complete-memory-and-timeout-errors/#post-10266023)
 * Hi [@djvenja](https://wordpress.org/support/users/djvenja/)
 * Please go to (Wordfence > Tools => Diagnostics) and click on “Send Report by 
   Email” button at the top of the page, you can send the report to “alaa [at] wordfence[
   dot] com”, make sure to include your forum username, I will take a look at this
   report and let you know my findings.
 * Thanks.
 *  Thread Starter [djvenja](https://wordpress.org/support/users/djvenja/)
 * (@djvenja)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/scans-never-complete-memory-and-timeout-errors/#post-10267938)
 * Hi [@wfalaa](https://wordpress.org/support/users/wfalaa/)
 * I have sent the report as requested (username included).
 *  Thread Starter [djvenja](https://wordpress.org/support/users/djvenja/)
 * (@djvenja)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/scans-never-complete-memory-and-timeout-errors/#post-10308879)
 * Hi [@wfalaa](https://wordpress.org/support/users/wfalaa/) – what did you manage
   to determine from the report I sent to you?

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Scans never complete – memory and timeout errors’ is closed to new replies.

 * ![](https://ps.w.org/wordfence/assets/icon.svg?rev=2070865)
 * [Wordfence Security - Firewall, Malware Scan, and Login Security](https://wordpress.org/plugins/wordfence/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordfence/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordfence/)
 * [Active Topics](https://wordpress.org/support/plugin/wordfence/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordfence/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordfence/reviews/)

 * 12 replies
 * 4 participants
 * Last reply from: [djvenja](https://wordpress.org/support/users/djvenja/)
 * Last activity: [7 years, 11 months ago](https://wordpress.org/support/topic/scans-never-complete-memory-and-timeout-errors/#post-10308879)
 * Status: not resolved