• Resolved vinnocorp

    (@vinnocorp)


    Hello guys,

    Does anyone have a clue how to fix this issue: The Wordfence begins manual on-demand scan but always finish it with:
    “Error writing value for wfsd_engine (MySQLi error: [2006] MySQL server has gone away)”

    A lot of settings were checked and tuned in an attempt to fix this issue. Here is some information about the environment:

    VPS Server
    OS Ubuntu 20.04 LTS.
    RAM: 1 GB
    Apache v2.0
    MySQL v8.0.21-0ubuntu0.20.04.3
    PHP v7.4.3
    WordPress v5.4.2
    Wordfence v7.4.9 (1594219913)

    Adjustments made:

    PHP Settings:
    max_execution_time = 300

    SQL Settings:
    max_allowed_packet = 128M
    wait_timeout = 28800
    net_read_timeout = 30
    net_write_timeout = 60
    interactive_timeout = 28800
    connect_timeout = 10

    Wordfence Settings:
    Use Low Resource Scanning – On
    How much memory should Wordfence request when scanning – 300
    Maximum execution time for each scan stage – 24

    Tested everything that was recommended by the Wordfence manual, including low-performance scanning. Nothing helped so far. Once during the tests, while turning off some plugins and switching to the default WordPress theme got this message:

    “Error reconnecting to the database This means that we lost contact with the database server at localhost. This could mean your host’s database server is down. Are you sure the database server is running? Are you sure the database server is not under particularly heavy load? If you’re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.”

    I am a little bit frustrated because the same exact environment on Ubuntu 18.04 works just fine with default settings and the same resources. I understand it is highly likely the MySQL issue. But what adjust and where?

    Please advise how to fix that issue!

    Thanks,
    vinnocorp

    • This topic was modified 4 years, 8 months ago by vinnocorp.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support WFAdam

    (@wfadam)

    Hello There @vinnocorp and thanks for reaching out to us!

    Most of the time when you see “MySQLi error: [2006] MySQL server has gone away”, its due to a Linux server operating system running low on memory and killing MySQL because it uses so much memory.

    If you could check your syslog file, you might be able to see what is exactly happening.

    Another possibility would be the server is running extremely low on disk space, but it’s not completely full. Full to the point that writing the somewhat large chunks of data to the database during the scan could temporarily be pushing it over the limit.

    Let me know if this helps!

    Thanks!

    Thread Starter vinnocorp

    (@vinnocorp)

    Hello @wfadam

    Thank you for your rapid response.

    Yeah that’s right, the server syslog file contains the following recurring records:

    ============================
    Jul 30 10:24:58 servername kernel: [ 643.120063] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/system.slice/mysql.service,task=mysqld,pid=881,uid=112
    Jul 30 10:24:58 servername kernel: [ 643.120123] Out of memory: Killed process 881 (mysqld) total-vm:1292100kB, anon-rss:446396kB, file-rss:0kB, shmem-rss:0kB, UID:112 pgtables:1224kB oom_score_adj:0
    Jul 30 10:24:58 servername kernel: [ 643.156482] oom_reaper: reaped process 881 (mysqld), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
    Jul 30 10:24:58 servername systemd[1]: mysql.service: Main process exited, code=killed, status=9/KILL
    Jul 30 10:24:58 servername systemd[1]: mysql.service: Failed with result ‘signal’.
    Jul 30 10:24:58 servername systemd[1]: mysql.service: Scheduled restart job, restart counter is at 1.
    Jul 30 10:24:58 servername systemd[1]: Stopped MySQL Community Server.
    Jul 30 10:24:58 servername systemd[1]: Starting MySQL Community Server…
    Jul 30 10:25:00 servername systemd[1]: Started MySQL Community Server.
    ============================

    So, I guess no server tuning would be helpful and the only solution is to expand RAM?

    Regards,
    vinnocorp

    Plugin Support WFAdam

    (@wfadam)

    Hello again @vinnocorp

    After doing some additional research on this issue, it seems that’s the case. I see some sites recommend doubling the RAM to test.

    Let me know if there is anything else we can assist you with!

    Thanks again!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Error writing value for wfsd_engine (MySQLi error: [2006] MySQL server has gone’ is closed to new replies.