Support » Plugin: Wordfence Security - Firewall & Malware Scan » Scan terminated with error: Unable to query database

  • Resolved Mindas22

    (@mindas22)


    The Wordfence scan is repeatedly failing on one of my sites, with this error:

    “Scan terminated with error: Unable to query database”

    Everything else seems to be working ok — any idea what would cause this?

    data from debug set on in options page.

    [Nov 15 23:17:38:1510787858.314435:10:info] SUM_KILLED:Previous scan terminated with an error. See below.
    [Nov 15 23:17:38:1510787858.313348:2:error] Scan terminated with error: Unable to query database
    [Nov 15 23:17:37:1510787857.684529:4:info] Calling Wordfence API v2.23:https://noc1.wordfence.com/v2.23/?v=4.8.3&s=https%3A%2F%2Fwww.woolinverse.com&k=f982ac6853d5aaa457d92f2e986a6fc427a0736aeaf8cc353ee72690bd396c378107d74daeffb1da15334ed7fce3cc8e902df03e04bbf2236b314f53e6d732a281e17b9ff6f238551cac2f7c5fbb4ff4&openssl=269484127&phpv=7.0.19-1&betaFeed=0&cacheType=disabled&action=record_scan_metrics
    [Nov 15 23:17:37:1510787857.682433:2:info] Done file contents scan
    [Nov 15 23:17:37:1510787857.680944:4:info] Using MySQLi directly.
    [Nov 15 23:17:37:1510787857.680374:4:info] Gathering host keys.
    [Nov 15 23:17:37:1510787857.679895:2:info] Asking Wordfence to check URLs against malware list.
    [Nov 15 23:17:37:1510787857.679280:2:info] Scanned contents of 1501 additional files at 31.53 per second
    [Nov 15 23:17:37:1510787857.677617:4:info] No files remaining for malware scan.
    [Nov 15 23:17:37:1510787857.644072:4:info] Scanning contents: wp-content/themes/flatsome/assets/img/payment-icons/icon-clickandbuy.svg.php (Size:5303B Mem:14.0M)
    [Nov 15 23:17:37:1510787857.623800:4:info] Scanning contents: wp-content/themes/flatsome/inc/builder/core/server/src/Ajax/Posts.php (Size:1988B Mem:14.0M)
    [Nov 15 23:17:37:1510787857.610392:4:info] Scanning contents: wp-content/themes/flatsome/inc/admin/kirki/assets/js/vendor/tinymce.plugin.code.js (Size:1570B Mem:14.0M)
    [Nov 15 23:17:37:1510787857.606822:2:info] Scanned contents of 1498 additional files at 31.51 per second
    [Nov 15 23:17:37:1510787857.590526:4:info] Scanning contents: wp-content/themes/flatsome/woocommerce/notices/error.php (Size:562B Mem:14.0M)
    [Nov 15 23:17:37:1510787857.576425:4:info] Scanning contents: wp-content/themes/flatsome/inc/builder/shortcodes/templates/ux_hotspot.html (Size:1118B Mem:14.0M)
    [Nov 15 23:17:37:1510787857.556158:4:info] Scanning contents: wp-content/themes/flatsome/page-my-account.php (Size:1190B Mem:14.0M)
    [Nov 15 23:17:37:1510787857.155556:4:info] Scanning contents: wp-content/plugins/worker/src/Google/Service/Drive.php (Size:167979B Mem:14.0M)
    [Nov 15 23:17:37:1510787857.142000:4:info] Scanning contents: wp-content/themes/flatsome/inc/admin/kirki/assets/js/vendor/codemirror/keymap/emacs.js (Size:13338B Mem:14.0M)
    [Nov 15 23:17:37:1510787857.127580:4:info] Scanning contents: wp-content/plugins/worker/src/MWP/EventListener/ActionRequest/VerifyNonce.php (Size:1646B Mem:14.0M)
    [Nov 15 23:17:37:1510787857.115430:4:info] Scanning contents: wp-content/themes/flatsome/woocommerce/single-product.php (Size:1080B Mem:14.0M)
    [Nov 15 23:17:37:1510787857.104188:4:info] Scanning contents: wp-content/plugins/worker/src/MWP/Process/ExecutableFinder.php (Size:621B Mem:14.0M)
    [Nov 15 23:17:37:1510787857.088370:4:info] Scanning contents: wp-content/themes/flatsome/inc/shortcodes/row.php (Size:4708B Mem:14.0M)
    [Nov 15 23:17:37:1510787857.032536:4:info] Scanning contents: wp-content/themes/flatsome/inc/admin/advanced/classes/class.options_machine.php (Size:29958B Mem:14.0M)
    [Nov 15 23:17:37:1510787857.021473:4:info] Scanning contents: wp-content/themes/flatsome/inc/admin/options/shop/options-shop-my-account.php (Size:755B Mem:14.0M)
    [Nov 15 23:17:36:1510787856.996424:4:info] Scanning contents: wp-content/themes/flatsome/inc/admin/kirki/includes/field/class-kirki-field-url.php (Size:999B Mem:14.0M)
    [Nov 15 23:17:36:1510787856.970265:4:info] Scanning contents: wp-content/themes/flatsome/inc/builder/shortcodes/ux_logo.php (Size:2853B Mem:14.0M)
    [Nov 15 23:17:36:1510787856.889303:4:info] Scanning contents: wp-content/plugins/worker/src/Google/IO/Stream.php (Size:5327B Mem:14.0M)
    [Nov 15 23:17:36:1510787856.859737:4:info] Scanning contents: wp-content/themes/flatsome/inc/admin/kirki/assets/js/vendor/codemirror/mode/haml/haml.js (Size:5332B Mem:14.0M)
    [Nov 15 23:17:36:1510787856.850576:4:info] Scanning contents: wp-content/plugins/worker/src/Symfony/Process/Exception/index.php (Size:28B Mem:14.0M)
    [Nov 15 23:17:36:1510787856.840271:4:info] Scanning contents: wp-content/themes/flatsome/sensei/wrappers/wrapper-end.php (Size:179B Mem:14.0M)
    [Nov 15 23:17:36:1510787856.827394:4:info] Scanning contents: wp-content/themes/flatsome/assets/img/payment-icons/icon-applepay.svg.php (Size:3188B Mem:14.0M)
    [Nov 15 23:17:36:1510787856.817055:4:info] Scanning contents: wp-content/themes/flatsome/inc/builder/shortcodes/values/align-v.php (Size:76B Mem:14.0M)
    [Nov 15 23:17:36:1510787856.806055:4:info] Scanning contents: wp-content/plugins/worker/src/MWP/EventListener/ActionResponse/SetActionData.php (Size:677B Mem:14.0M)
    [Nov 15 23:17:36:1510787856.798324:4:info] Scanning contents: wp-content/themes/flatsome/inc/admin/kirki/assets/js/branding.js (Size:426B Mem:14.0M)
    [Nov 15 23:17:36:1510787856.787161:4:info] Scanning contents: wp-content/plugins/worker/src/MWP/Security/NonceInterface.php (Size:556B Mem:14.0M)
    [Nov 15 23:17:36:1510787856.772659:4:info] Scanning contents: wp-content/themes/flatsome/inc/admin/kirki/includes/output/property/class-kirki-output-property-background-position.php (Size:1969B Mem:14.0M)
    [Nov 15 23:17:36:1510787856.760979:4:info] Scanning contents: wp-content/themes/flatsome/template-parts/header/partials/element-wishlist-mobile.php (Size:407B Mem:14.0M)
    [Nov 15 23:17:36:1510787856.750141:4:info] Scanning contents: wp-content/themes/flatsome/template-parts/portfolio/archive-portfolio-title-breadcrumbs.php (Size:573B Mem:14.0M)
    [Nov 15 23:17:36:1510787856.742737:4:info] Scanning contents: wp-content/themes/flatsome/inc/admin/kirki/assets/js/l10n.js (Size:128B Mem:14.0M)
    [Nov 15 23:17:36:1510787856.735301:4:info] Scanning contents: wp-content/themes/flatsome/inc/admin/kirki/assets/js/controls/generic.js (Size:367B Mem:14.0M)
    [Nov 15 23:17:36:1510787856.721381:4:info] Scanning contents: wp-content/themes/flatsome/template-parts/posts/content-single.php (Size:1997B Mem:14.0M)
    [Nov 15 23:17:36:1510787856.707030:4:info] Scanning contents: wp-content/themes/flatsome/assets/img/payment-icons/icon-cashcloud.svg.php (Size:6831B Mem:14.0M)
    [Nov 15 23:17:36:1510787856.687051:4:info] Scanning contents: wp-content/themes/flatsome/inc/admin/kirki/includes/controls/class-kirki-controls-date-control.php (Size:1829B Mem:14.0M)
    [Nov 15 23:17:36:1510787856.667086:4:info] Scanning contents: wp-content/themes/flatsome/inc/shortcodes/scroll_to.php (Size:577B Mem:14.0M)

    Some logs from nginx error.log:

     [error] 6592#6592: *26906 FastCGI sent in stderr: "PHP message: WordPress database error Table 'woolindb.wp_wfNet404s' doesn't exist for query truncate table wp_wfNet404s made by do_action_ref_array, WP_Hook->do_action, WP_Hook->apply_filters, wordfence::hourlyCron, wfDB->truncate, wfDB->queryWrite
    PHP message: WordPress database error Table 'woolindb.wp_wfNet404s' doesn't exist for query delete from wp_wfNet404s made by do_action_ref_array, WP_Hook->do_action, WP_Hook->apply_filters, wordfence::hourlyCron, wfDB->truncate, wfDB->queryWrite
    PHP message: WordPress database error Table 'woolindb.wp_wfVulnScanners' doesn't exist for query select IP from wp_wfVulnScanners where ctime > unix_timestamp() - 3600 made by do_action_ref_array, WP_Hook->do_action, WP_Hook->apply_filters, wordfence::hourlyCron, wfDB->querySelect
    PHP message: WordPress database error Table 'woolindb.wp_wfVulnScanners' doesn't exist for query truncate table wp_wfVulnScanners made by do_action_ref_array, WP_Hook->do_action, WP_Hook->apply_filters, wordfence::hourlyCron, wfDB->truncate, wfDB->queryWrite
    PHP message: WordPress database error Table 'woolindb.wp_wfVulnScanners' doesn't exist for query delete from wp_wfVulnScanners made by do_action_ref_array, WP_Hook->do_action, WP_Hook->apply_filters, wordfence::hourlyCron, wfDB->truncate, wfDB->queryWrite" while reading response header from upstream, client: 108.61.190.217, server: woolinverse.com, request: "POST /wp-cron.php?doing_wp_cron=1510787951.2097060680389404296875 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "www.woolinverse.com", referrer: "https://www.woolinverse.com/wp-cron.php?doing_wp_cron=1510787951.2097060680389404296875"
    
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @mindas22,

    Could you please confirm which version of MySQL you’re running?

    Also, have you checked the MySQL logs to see if there are any errors at the time of the scan?

    Have you tried repairing the 2 tables mentioned in the error messages (wfNet404s and wfVulnScanners)?

    Hi, thanks for coming back so quick.
    MYSQL server is : Server version: 10.1.26-MariaDB-0+deb9u1 Debian 9.1

    I checked the mysql error log ant there were not any errors.

    What I did while waiting for your response: I did clean reinstall of wordfence.After that scan was successful.

    But I remember was getting same problem on other server with Mariadb 10.0.32-MariaDB-0+deb8u1 (Debian) on couple of other websites. I tried repair tables that time, but that was unsuccessful. Had to reinstall wordfence clean as well.

    Any ideas?

    Hi @mindas22,

    Thanks for the feedback.

    If reinstalling Wordfence after removing all data fixed the issue then it definitely seems to be related to the database –most likely tables corruption.

    This could be related to the storage engine you’re using; we recommend to use InnoDB instead of MyISAM if possible, since the former is less prone to crash.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Scan terminated with error: Unable to query database’ is closed to new replies.