/etc/init.d/mysql does not respect resource limits when Linux starts up
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
Percona Server moved to https://jira.percona.com/projects/PS | Status tracked in 5.7 | |||||
5.1 |
Won't Fix
|
Wishlist
|
Unassigned | |||
5.5 |
Triaged
|
Wishlist
|
Unassigned | |||
5.6 |
Triaged
|
Wishlist
|
Unassigned | |||
5.7 |
Triaged
|
Wishlist
|
Unassigned |
Bug Description
I'm filing this as a feature request
Current resource limits when Linux(CentOS 6) starts up:
/etc/security/
root soft nproc 3000
root hard nproc unlimited
Limits of init process:
cat /proc/1/limits |grep processes
Max processes 3778 3778 processes
Limits of mysqld:
cat /proc/`pidof mysqld`/limits |grep processes
Max processes 3778 3778 processes
Resource limits of mysqld after restarting MySQL as root:
[root@localhost ~]# cat /proc/`pidof mysqld`/limits |grep processes
Max processes 3000 unlimited processes
Workaround is to use runuser to start mysqld_safe on /etc/init.d/mysql:
Look for:
# Give extra arguments to mysqld with the my.cnf file. This script
# may be overwritten at next upgrade.
$
wait_for_pid created "$!" "$mysqld_
Change to:
# Give extra arguments to mysqld with the my.cnf file. This script
# may be overwritten at next upgrade.
runuser -l mysql -c "$bindir/
wait_for_pid created "$!" "$mysqld_
Under /etc/security/
/etc/security/
mysql soft nproc 3000
mysql hard nproc unlimited
tags: | added: pkg |
Able to reproduce the same.
[root@centos65 ~]# ps -ef | grep mysql mysqld_ safe --datadir= /var/lib/ mysql --pid-file= /var/lib/ mysql/centos65. pid /var/lib/ mysql --plugin- dir=/usr/ lib64/mysql/ plugin --user=mysql --log-error= /var/log/ mysqld. log --pid-file= /var/lib/ mysql/centos65. pid --socket= /var/lib/ mysql/mysql. sock
root 2621 1 0 15:02 pts/1 00:00:00 /bin/sh /usr/bin/
mysql 2785 2621 4 15:02 pts/1 00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=
root 2811 2562 0 15:02 pts/1 00:00:00 grep mysql
[root@centos65 ~]#
[root@centos65 ~]# cat /proc/2785/limits |grep processes
Max processes 7809 unlimited processes
[root@centos65 ~]#
[root@centos65 ~]# cat /etc/security/ limits. d/90-nproc. conf | grep nproc
* soft nproc 1024
root soft nproc 3000
root hard nproc unlimited
[root@centos65 ~]#
From another session:
[root@centos65 ~]# service mysql restart mysqld_ safe --datadir= /var/lib/ mysql --pid-file= /var/lib/ mysql/centos65. pid /var/lib/ mysql --plugin- dir=/usr/ lib64/mysql/ plugin --user=mysql --log-error= /var/log/ mysqld. log --pid-file= /var/lib/ mysql/centos65. pid --socket= /var/lib/ mysql/mysql. sock
Shutting down MySQL (Percona Server)... SUCCESS!
Starting MySQL (Percona Server). SUCCESS!
[root@centos65 ~]#
[root@centos65 ~]# ps -ef | grep mysql
root 3147 1 0 15:07 pts/2 00:00:00 /bin/sh /usr/bin/
mysql 3311 3147 3 15:07 pts/2 00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=
root 3337 3089 0 15:07 pts/2 00:00:00 grep mysql
[root@centos65 ~]#
[root@centos65 ~]#
[root@centos65 ~]# cat /proc/3311/limits |grep processes
Max processes 7809 unlimited processes
[root@centos65 ~]#
[root@centos65 ~]# cat /proc/3147/limits |grep processes
Max processes 3000 unlimited processes
[root@centos65 ~]#
After reboot the server, mysqld_ safe --datadir= /var/lib/ mysql --pid-file= /var/lib/ mysql/centos65. pid /var/lib/ mysql --plugin- dir=/usr/ lib64/mysql/ plugin --user=mysql --log-error= /var/log/ mysqld. log --pid-file= /var/lib/ mysql/centos65. pid --socket= /var/lib/ mysql/mysql. sock
[root@centos65 ~]# ps -ef | grep mysql
root 1417 1 0 15:09 ? 00:00:00 /bin/sh /usr/bin/
mysql 1581 1417 0 15:09 ? 00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=
root 1903 1885 0 15:11 pts/0 00:00:00 grep mysql
[root@centos65 ~]#
[root@centos65 ~]# cat /proc/1581/limits |grep processes
Max processes 7809 7809 processes
[root@centos65 ~]#
[root@centos65 ~]# cat /proc/1417/limits |grep processes
Max processes 7809 7809 processes
[root@centos65 ~]#