• Hello,

    I had run into a rare issue, can’t seem to find anything related.

    It seems like every time a post is being created the is a SQL query that takes to long to process and therefore it creates a database error Lost connection error(please see below.)

    Everything is up to date and was working just find, all of the sudden I have a crashed website with a 6GB error log.

    I had to remove all plugins and theme to be able to log in back to the site.

    From some researched I fund that it cold have been a broken database.
    I reached out to the web host provider, and they assured me the database was working fine on their end, that is was word-press creating such a long query breaking the site.

    Has anyone seen anything like this? and know how to fix it?
    The site is up now, but still lags when we try to creat a new post.

    Any help will be greatly appreciated.

    [17-Aug-2018 11:55:27 UTC] WordPress database error Lost connection to MySQL server during query for query SELECT post_modified_gmt FROM wp_posts WHERE post_status = ‘publish’ AND post_type IN (‘post’, ‘page’, ‘attachment’) ORDER BY post_modified_gmt DESC LIMIT 1 made by require(‘wp-blog-header.php’), wp, WP->main, WP->send_headers, get_lastpostmodified, _get_last_post_time

    [17-Aug-2018 12:04:57 UTC] WordPress database error Lost connection to MySQL server during query for query SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.post_type = ‘post’ AND (wp_posts.post_status = ‘publish’) ORDER BY wp_posts.post_date DESC LIMIT 0, 10 made by require(‘wp-blog-header.php’), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi, this could be an issue with MySQL. If the MySQL server is intermittently going up and down while you’re running a query it can lead to that error.

    When you disable all plugins does the error still occur? You can use this WordPress plugin: https://www.ads-software.com/plugins/query-monitor/ to see which plugins or functions are performing poorly.

    Hope it helps.

    Thread Starter Cesar R

    (@ruzzo007)

    Yeah I still get the error with the plugins deactivated. The error seems to be generated at them moment when I click the create new post button and when I click the publish button.

    [17-Aug-2018 19:04:28 UTC] WordPress database error Lost connection to MySQL server during query for query SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND (wp_posts.post_author = 1) AND wp_posts.post_type = ‘post’ AND (wp_posts.post_status = ‘publish’) ORDER BY wp_posts.post_date DESC LIMIT 2030, 10 made by require(‘wp-blog-header.php’), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts
    [17-Aug-2018 19:06:43 UTC] WordPress database error Lost connection to MySQL server during query for query SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.post_type = ‘post’ AND (wp_posts.post_status = ‘publish’) ORDER BY wp_posts.post_date DESC LIMIT 0, 10 made by require(‘wp-blog-header.php’), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts
    [17-Aug-2018 19:06:58 UTC] WordPress database error Lost connection to MySQL server during query for query SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.post_type = ‘post’ AND (wp_posts.post_status = ‘publish’) ORDER BY wp_posts.post_date DESC LIMIT 0, 10 made by require(‘wp-blog-header.php’), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts

    Try installing the plugin I mentioned in my last post. If it’s not showing that the theme or any WP functions are performing poorly then check with your host. Hope it helps.

    Thread Starter Cesar R

    (@ruzzo007)

    After checking with Query Monitor I see this:

    caller: WP_Term_Query->get_terms()
    Componet:Component
    Error Message:Lost connection to MySQL server during query
    Error Code:2013
    Query:
    SELECT t.*, tt.*
    FROM wp_terms AS t
    INNER JOIN wp_term_taxonomy AS tt
    ON t.term_id = tt.term_id
    WHERE tt.taxonomy IN (‘post_tag’)
    AND tt.count > 0
    ORDER BY t.name ASC

    I’d contact your hosting provider about this. Sorry, there’s not much else I can recommend ??

    Thread Starter Cesar R

    (@ruzzo007)

    Yes, that was one of the first things I did, according to them, they do not see any issues on their end.

    Thank you anyways.

    Thread Starter Cesar R

    (@ruzzo007)

    After some research it seems the SQL database is not playing nicely with the PHP version. but I haven’t find a way to correct that part.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Issues while creating posts’ is closed to new replies.