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

Jerms

Registered
Oct 1, 2015
2
0
1
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?
 
Last edited by a moderator:

Jcats

Well-Known Member
PartnerNOC
May 25, 2011
807
160
168
New Jersey
cPanel Access Level
DataCenter Provider
I would recommend going into Tweak Settings and disabling "Use INFORMATION_SCHEMA to acquire MySQL disk usage"
 

Jerms

Registered
Oct 1, 2015
2
0
1
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!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
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.