• Ambyomoron

    (@josiah-s-carberry)


    About once a month, during which there are probably 15-30 plugin upgrades, I get the following server error:

    PHP Warning: mysqli_query(): MySQL server has gone away in /blahblah/web/blog/wp-includes/wp-db.php on line 1811, referer: https://mysite.com/wp-admin/update-core.php?action=do-plugin-upgrade
    
    This error message is immediately followed by:

    mysqli_query(): Error reading result set’s header in /blahblha/web/blog/wp-includes/wp-db.php on line 1811, referer: https://mysite.com/wp-admin/update-core.php?action=do-plugin-upgrade

    From the user point of view, the plugin installation takes a long time, before getting the error.

    I cannot correlate the error with anything – neither plugin nor date nor time nor…

    In spite of the error, the plugin appears to have been successfully updated (I think), although I usually reinstall it, just in case. There is never such errors during reinstall.

    If no one else knows right off the bat what might be causing this, can someone suggest a diagnostic technique that would allow me to focus better on what is going wrong?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    I suspect your site is getting too busy and the OS is shutting down the database server to try to avoid crashing entirely. Are you hosting on your own VPS or on a shared host?

    Thread Starter Ambyomoron

    (@josiah-s-carberry)

    It’s a shared host.
    So what you’re suggesting is that the database server is undersized relative to certain peak loads put on it, is that right?
    Why would this happen only when updating a plugin and not during other transactions, such as saving a blog, or something else?

    Josiah,

    I have had similar issues with the automated plugin updater. I raised the max memory allocation for PHP to 256mb and made sure the PHP version was up to date (version 5.6.21, to solve a different issue with WooCommerce) and the error messages stopped.

    Maybe this can help. Good luck.
    Brett

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    It’s a shared host.

    Contact your host; there’s an issue with the MySQL server.

    Thread Starter Ambyomoron

    (@josiah-s-carberry)

    Brett,
    Are you referring to WP_MAX_MEMORY_LIMIT or to WP_MEMORY_LIMIT or to both?

    Josiah,

    WP_MEMORY_LIMIT is what I have set to 256mb. I don’t set the MAX value to anything specific, I let the default function push the MAX to the WP_MEMORY_LIMIT setting.

    Good lUck,
    Brett

    Thread Starter Ambyomoron

    (@josiah-s-carberry)

    My hosting provider has come back with the following remarks:

    This type of error often comes from keeping a mysql connection open without making any requests after a certain time, after which the connection is shut down: https://dev.mysql.com/doc/refman/5.7/en/gone-away.html

    The variables wait_timeout and interactive_timeout which control this disconnection are set for 30 seconds: https://dev.mysql.com/doc/refman/5.0/en/communication-errors.html

    >It’s enough if the script does a “ping” regularly to avoid this problem; better still, before sending a request, test to see if the connection is still live and if not, restart it.

    Can someone tell me if:
    1) the 30 sec timeout corresponds to something recommended by WordPress; and
    2) whether the wordpress code performs the suggested check, namely, it does not assume that a Mysql connection is alive before using it; rather, it checks first and reconnects if necessary.

    Hey @josiah S. Carberry,
    I suppose, max_allowed_packet and read_buffer_size these 2 variables in mysql config should be set to a higher value to avoid such an error. I’ve experienced similar issues and It turns out that these 2 config vars have to be set to a higher value. But as you are using a shared hosting environment , It’s difficult that you could be able to increase it any further. Anyways, get in touch with your host and ask them about these.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘"MySQL server has gone away" during plugin upgrade’ is closed to new replies.