Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

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.

MySQL Keeps Crashing

Discussion in 'Database Discussions' started by gseven, Mar 25, 2017.

  1. gseven

    gseven Member

    Joined:
    Jul 8, 2010
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    51
    cPanel Access Level:
    Root Administrator
    Hello everyone,
    Following is the email that server sent:

    Out of memory: The process “mysqld” was terminated because the system is low on memory.
    In order to avoid a system crash due to low memory, the kernel terminated the process named “mysqld” with the PID “12653”.

    Process Name mysqld
    Event Time Saturday, March 25, 2017 at 6:47:07 AM UTC
    PID 12653
    Process UID 496
    Process Username mysql
    Process Total Virtual Memory 923976kB
    Process Anonymous Resident Set Size 272236kB
    Process File Resident Set Size 36kB
    Process OOM Score 142
    Status Out of Memory ⚠
    Memory Information
    Used 395 MB
    Available 1.45 GB
    Installed 1.83 GB
    Load Information 4.27 1.59 0.62
    Uptime 1 day, 19 hours, 50 minutes, and 22 seconds
    IOStat Information avg-cpu: %user %nice %system %iowait %steal %idle 4.21 0.03 0.94 0.44 0.01 94.35 Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn sda 8.17 214.93 133.23 33920964 21025952
    Top Processes
    PID
    Owner CPU % Memory % Command
    13814 root 6.58 1.78 tailwatchd - chkservd - sending OOM notification
    13813 root 6.58 1.77 tailwatchd - chkservd - sending OOM notification
    13811 root 6.49 1.77 tailwatchd - chkservd - sending OOM notification
    13816 root 6.67 1.75 tailwatchd - chkservd - sending OOM notification
    13812 root 6.58 1.75 tailwatchd - chkservd - sending OOM notification


    For addtional details, see the attached dmesg log dump.



    Preview of “oom_dmesg.txt”
    [157770.664508] [13518] 506 13518 64760 8629 1 0 0 php-cgi
    [157770.666523] [13519] 506 13519 64778 8721 1 0 0 php-cgi
    [157770.668516] [13520] 506 13520 64779 8731 0 0 0 php-cgi
    [157770.670589] [13521] 506 13521 64827 8698 0 0 0 php-cgi
    [157770.672543] [13522] 506 13522 64518 8451 0 0 0 php-cgi
    [157770.674369] [13523] 99 13523 140791 1188 1 0 0 httpd
    [157770.676201] [13551] 506 13551 64135 8027 1 0 0 php-cgi
    [157770.678169] [13570] 506 13570 62488 6432 0 0 0 php-cgi
    [157770.680362] Out of memory: Kill process 12653 (mysqld) score 142 or sacrifice child
    [157770.682397] Killed process 12653, UID 496, (mysqld) total-vm:923976kB, anon-rss:272236kB, file-rss:36kB

    Following are my cat /etc/my.cnf settings:

    s26.postimg.org/wxfyaxjt5/mycnf.jpg
     
    #1 gseven, Mar 25, 2017
    Last edited by a moderator: Mar 25, 2017
  2. SysSachin

    SysSachin Well-Known Member

    Joined:
    Aug 23, 2015
    Messages:
    562
    Likes Received:
    40
    Trophy Points:
    28
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Twitter:
    Mysql process terminated due to low memory on your server. Please check the memory status using the below command.
    Code:
    free -m
    
     
  3. gseven

    gseven Member

    Joined:
    Jul 8, 2010
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    51
    cPanel Access Level:
    Root Administrator
    This is the current status of RAM:
    s26.postimg.org/d5iu8rekp/Screen_Shot_2017-03-25_at_6.23.26_PM.png
    It suddenly crashes in 2-3 days and works fine again after restart. Corrupt database could be an issue?

    Mod Note: Please Attach Images to Your Posts
     
    #3 gseven, Mar 25, 2017
    Last edited by a moderator: Mar 25, 2017
  4. SysSachin

    SysSachin Well-Known Member

    Joined:
    Aug 23, 2015
    Messages:
    562
    Likes Received:
    40
    Trophy Points:
    28
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    You are facing because of low memory so you need to monitor your server and need to find out which process is using your server
    memory. Also I will suggest you please try to run MySQLTuner.pl on your server and adjust your MySQL configuration.
     
  5. gseven

    gseven Member

    Joined:
    Jul 8, 2010
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    51
    cPanel Access Level:
    Root Administrator
    Thank you, SysSachin.

    These are the recommendations from MySQLTuner:

    https://s26.postimg.org/461o4nibt/rec_1.jpg

     
  6. SysSachin

    SysSachin Well-Known Member

    Joined:
    Aug 23, 2015
    Messages:
    562
    Likes Received:
    40
    Trophy Points:
    28
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Twitter:
    You can modify/add values to the /etc/my.cnf file based on the "Variables to adjust" from the MySQL tuner. Let MySQL run for at least 24 hours after the change and then run the tuner again to see if additional adjustments are recommended.

    Also, Monitor your server and try to find out which process is using high memory on your server
     
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,424
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    You may also want to utilize the "mysqladmin processlist" command to see if any particular databases or tables are using an excessive amount of resources at any given time.

    Thank you.
     
  8. ssfred

    ssfred Well-Known Member

    Joined:
    Jan 6, 2012
    Messages:
    64
    Likes Received:
    4
    Trophy Points:
    58
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello

    Since OOM killer frequently terminates MySQL server, it means that MySQL keeps on occupying the top position for resource usage. So the prime target is d to identify the cause for the issue. There can be multiple reasons such as a corrupted DB, poorly optimized db queries, unlimited connections etc. Kindly perform the following checks
    1. As mentioned by cPanelMichael, Check the active mysql process by executing the command

    #mysqladmin processlist
    or
    #mysqladmin proc stat

    2. Check whether slow queries are eating up resources by enabling "Slow Query Log"

    3. Check whether any resource monitoring tools like PRM are installed and they gets triggered and terminates the process.

    Thank You,
     
    cPanelMichael likes this.
Loading...

Share This Page