The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Cron job killing mysql - /usr/local/cpanel/scripts/update_db_cache

Discussion in 'Database Discussions' started by Jerms, Oct 1, 2015.

  1. Jerms

    Jerms Registered

    Joined:
    Oct 1, 2015
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Cleveland
    cPanel Access Level:
    Root Administrator
    For the past few days, I've been receiving an email with the following message:
    Code:
    DBD::mysql::st execute failed: Lost connection to MySQL server during query
    at /usr/local/cpanel/Cpanel/Exception.pm line 156.
        Cpanel::Exception::new("Cpanel::Exception::Database::Error", Cpanel::ExceptionMessage::Raw=SCALAR(0x1b9e320), HASH(0x3f879b8)) called at /usr/local/cpanel/Cpanel/Exception.pm line 57
        Cpanel::Exception::create("Database::Error", Cpanel::ExceptionMessage::Raw=SCALAR(0x1b9e320), HASH(0x3f879b8)) called at /usr/local/cpanel/Cpanel/Exception.pm line 72
        Cpanel::Exception::create_raw("Database::Error", "DBD::mysql::st execute failed: Lost connection to MySQL serve"..., HASH(0x3f879b8)) called at /usr/local/cpanel/Cpanel/DBI.pm line 105
        Cpanel::DBI::_create_exception(Cpanel::DBI::Mysql::st=HASH(0x3f876b8), "DBD::mysql::st execute failed: Lost connection to MySQL serve"..., undef) called at /usr/local/cpanel/Cpanel/DBI.pm line 93
        Cpanel::DBI::_error_handler("DBD::mysql::st execute failed: Lost connection to MySQL serve"..., Cpanel::DBI::Mysql::st=HASH(0x3f876b8), undef) called at bin/update_db_cache.pl line 323
        Script::Update::DB::Cache::can_get_mysql_usage(HASH(0x1b96e38), HASH(0x1bb1f58), Cpanel::DB::Map::Collection::Index=HASH(0x3f59240)) called at bin/update_db_cache.pl line 57
        Script::Update::DB::Cache::script("Script::Update::DB::Cache") called at bin/update_db_cache.pl line 32
    
    Every 4 hours, a cron job runs /usr/local/cpanel/scripts/update_db_cache, which then kills mysql. The only way I'm able to restart mysql is by regenerating the ib_logfile0 and ib_logfile1, and then restarting mysql.

    Any advice?
     
    #1 Jerms, Oct 1, 2015
    Last edited by a moderator: Oct 1, 2015
  2. Jcats

    Jcats Well-Known Member

    Joined:
    May 25, 2011
    Messages:
    275
    Likes Received:
    31
    Trophy Points:
    28
    Location:
    New Jersey
    cPanel Access Level:
    DataCenter Provider
    I would recommend going into Tweak Settings and disabling "Use INFORMATION_SCHEMA to acquire MySQL disk usage"
     
  3. Jerms

    Jerms Registered

    Joined:
    Oct 1, 2015
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Cleveland
    cPanel Access Level:
    Root Administrator
    Jcats, thanks so much for that recommendation. I have not tried that yet, but prior to seeing your message, I tried something else that might have done the trick. I noticed in my cpanel error log the following error regarding the mysql.sock file.

    Code:
    Cpanel::Exception::create_raw("Database::Error", "Can't connect to local MySQL server through socket '/tmp/mysq"..., HASH(0x20d6a38)) called at /usr/local/cpanel/Cpanel/DBI.pm line 56
    [2015-10-01 01:49:15 -0400] warn [cpses_tool] Error while connecting to MySQL: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) at /usr/local/cpanel/Cpanel/DBAdmin.pm line 168
    I ended up adding " socket=/var/lib/mysql/mysql.sock " to my root/.my.cnf file and after that mysql stopped crashing and the emails regarding the error stopped coming.

    I wish I understood better the relationship between all of these pieces and parts, but for the meantime, I think I'm good. Thanks again!
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,713
    Likes Received:
    658
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    You can also review the MySQL error log (/var/lib/mysql/$hostname.err) directly after running the "/usr/local/cpanel/scripts/update_db_cache" command (assuming you have no manual workaround in-place) to see why MySQL is failing.

    Thank you.
     

Share This Page