一 问题描述
创新互联专注于绿春企业网站建设,成都响应式网站建设公司,商城建设。绿春网站建设公司,为绿春等地区提供建站服务。全流程定制网站开发,专业设计,全程项目跟踪,创新互联专业和态度为您提供的服务将一台zabbix proxy由2.4.5升级到3.0.2后启动了就直接崩溃了。
错误信息如下:
2367:20160508:153246.830 One child process died (PID:42385,exitcode/signal:11). Exiting ...42367:20160508:153248.904 Zabbix Proxy stopped. Zabbix 3.0.2 (revision 59540).将日志级别调高点,设置DebugLevel=4,查看报错
42629:20160508:153529.004 Got signal [signal:15(SIGTERM),sender_pid:42623,sender_uid:498,reason:0]. Exiting ... 42628:20160508:153529.004 Got signal [signal:15(SIGTERM),sender_pid:42623,sender_uid:498,reason:0]. Exiting ... 42634:20160508:153529.004 Got signal [signal:15(SIGTERM),sender_pid:42623,sender_uid:498,reason:0]. Exiting ... 42651:20160508:153529.004 Got signal [signal:15(SIGTERM),sender_pid:42623,sender_uid:498,reason:0]. Exiting ... 42659:20160508:153529.004 Got signal [signal:15(SIGTERM),sender_pid:42623,sender_uid:498,reason:0]. Exiting ... 42661:20160508:153529.005 Got signal [signal:15(SIGTERM),sender_pid:42623,sender_uid:498,reason:0]. Exiting ... 42655:20160508:153529.005 Got signal [signal:15(SIGTERM),sender_pid:42623,sender_uid:498,reason:0]. Exiting ... 42663:20160508:153529.005 Got signal [signal:15(SIGTERM),sender_pid:42623,sender_uid:498,reason:0]. Exiting ... 42664:20160508:153529.005 Got signal [signal:15(SIGTERM),sender_pid:42623,sender_uid:498,reason:0]. Exiting ... 42666:20160508:153529.005 Got signal [signal:15(SIGTERM),sender_pid:42623,sender_uid:498,reason:0]. Exiting ... 42665:20160508:153529.006 Got signal [signal:15(SIGTERM),sender_pid:42623,sender_uid:498,reason:0]. Exiting ... 42667:20160508:153529.006 Got signal [signal:15(SIGTERM),sender_pid:42623,sender_uid:498,reason:0]. Exiting ... 42630:20160508:153529.006 Got signal [signal:15(SIGTERM),sender_pid:42623,sender_uid:498,reason:0]. Exiting ... 42668:20160508:153529.006 Got signal [signal:15(SIGTERM),sender_pid:42623,sender_uid:498,reason:0]. Exiting ... 42671:20160508:153529.006 Got signal [signal:15(SIGTERM),sender_pid:42623,sender_uid:498,reason:0]. Exiting ... 42670:20160508:153529.007 Got signal [signal:15(SIGTERM),sender_pid:42623,sender_uid:498,reason:0]. Exiting ... 42647:20160508:153529.007 Got signal [signal:15(SIGTERM),sender_pid:42623,sender_uid:498,reason:0]. Exiting ... 42674:20160508:153529.007 Got signal [signal:15(SIGTERM),sender_pid:42623,sender_uid:498,reason:0]. Exiting ... 42680:20160508:153529.007 Got signal [signal:15(SIGTERM),sender_pid:42623,sender_uid:498,reason:0]. Exiting ... 42679:20160508:153529.008 Got signal [signal:15(SIGTERM),sender_pid:42623,sender_uid:498,reason:0]. Exiting ... 9102:20160508:170455.283 End of zbx_strpool_destroy() 9102:20160508:170455.283 End of free_configuration_cache() 9102:20160508:170455.283 In free_ipmi_handler() 9102:20160508:170455.283 End of free_ipmi_handler() 9102:20160508:170455.284 In free_selfmon_collector() collector:0x7fa793e23000 9102:20160508:170455.284 End of free_selfmon_collector() 9102:20160508:170455.284 In unload_modules() 9102:20160508:170455.284 End of unload_modules() 9102:20160508:170455.284 Zabbix Proxy stopped. Zabbix 3.0.2 (revision 59540). zabbix_proxy [9152]: [file:'selfmon.c',line:375] lock failed: [22] Invalid argument总共有4台proxy,每台proxy的操作系统版本都是CentOS6。就单独这一台zabbix proxy启动有问题,刚启动就有进程死掉。
二 问题解决
查看这台proxy服务器的内核版本是3.9.8-1.el6.elrepo.x86_64,而其他几台proxy的内核版本是2.6.32-358.el6.x86_64 刚开始也没有朝着内核版本的问题方向思考。以为还是proxy的版本或者系统参数设置有问题。
1.排查Linux下的信号量
查看Zabbix的官方BUG追踪平台Invalid argument可能是信号量达到了限制
可以尝试增大信号量的值
echo 256 40000 32 32000 > /proc/sys/kernel/sem
这个四个参数分别是
SEMMSL 每个信号量集的含有的信号量的大值
SEMMNS 系统层面的信号量数量大限制
SEMOPM semop(2)调用可以指定的大操作数量
SEMMNI 系统层面的信号数量最小限制
通过echo方式更改重启后会失效,可以更改/etc/sysctl.conf
kernel.sem = 250 32000 100 10000
然后执行sysctl -p
更改参数后proxy启动仍然会崩溃
2.排查内核版本原因
Updating to latest kernel (3.10.0-327.10.1.el7.x86_64) + reboot solved it for me
The error reported originally may be something else than what affected me.
查看帖子怀疑是内核版本造成的,这台proxy以前有人升级过内核,更改linux启动项设置默认启动内核为2.6.32.重启后问题得到解决,proxy不再崩溃。但是之前proxy 2.4.5在3.9.8的内核上可以正常运行。
遇到这个BUG的人挺多的,有好几个帖子都是反馈这个问题。
三 补充知识
这个BUG涉及到Linux下的信号量相关的知识。信号量是为了解决在多进程编程下资源共享的问题。著名的用信号量来解决的就是哲学家就餐问题。
Linux下使用ipcs命令来查看共享内存,信号量和消息队列
ipcs 默认是-a参数,显示所有信息
# ipcs ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status 0x6c6c6536 0 root 600 4096 0 0x68031618 1835009 zabbix 600 8388583 0 0x6c030ad7 11632648 zabbixagen 600 365056 13 0x68031672 2392073 zabbix 600 8388583 0 0x78031672 2424842 zabbix 600 16777216 0 0x74031672 2457611 zabbix 600 4194304 0 0x67031672 2490380 zabbix 600 1336934400 0 0x73031672 2523149 zabbix 600 235929600 0 ------ Semaphore Arrays -------- key semid owner perms nsems 0x00000000 0 root 600 1 0x00000000 32769 root 600 1 0x00000000 4325378 apache 600 1 0x7a031618 622595 zabbix 600 12 0x00000000 4358148 apache 600 1 0x7a030ad7 4292613 zabbixagen 600 13 0x7a031672 851974 zabbix 600 12 0x7a031638 1015815 zabbix 600 12 0x7a031620 1441800 zabbix 600 12 ------ Message Queues -------- key msqid owner perms used-bytes messagesipcs -m 单独显示共享内存片段信息
ipcs -s 单独显示信号量
ipcs -q 单独显示消息队列
# ipcs -u ------ Shared Memory Status -------- segments allocated 71 pages allocated 1795473 pages resident 68130 pages swapped 57636 Swap performance: 0 attempts 0 successes ------ Semaphore Status -------- used arrays = 16 allocated semaphores = 152 ------ Messages: Status -------- allocated queues = 0 used headers = 0 used space = 0 bytes参考资料:
https://support.zabbix.com/browse/ZBX-10657
http://www.cnblogs.com/forilen/p/4316358.html
https://support.zabbix.com/browse/ZBX-3974
http://blog.zabbix.com/mysterious-zabbix-problems-how-we-debug-them/1023/
https://en.wikipedia.org/wiki/Semaphore_(programming)
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。