linux信号量超过系统限制
部署一台新服务器,信号量报错,观察也没有key冲突,错误分析及解决如下:
创建一个不存在的信号量集返回参数错误的报错,因为信号量集的信号量数量超过了系统限制。
系统默认
/home/poc#ipcs -ls
------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 100
semaphore max value = 32767
------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 100
semaphore max value = 32767
信号量的配置文件路径 /etc/sysctl.conf
kernel.sem配置项
直接修改配置文件不会立即生效,调用sysctl命令可以修改文件并刷新系统配置
sysctl -w kernel.sem="40960 2048000 40960 20480"
/home/poc#ipcs -ls
------ Semaphore Limits --------
max number of arrays = 20480
max semaphores per array = 40960
max semaphores system wide = 2048000
max ops per semop call = 40960
semaphore max value = 32767
------ Semaphore Limits --------
max number of arrays = 20480
max semaphores per array = 40960
max semaphores system wide = 2048000
max ops per semop call = 40960
semaphore max value = 32767