解决[notice] child pid 1421 exit signal Segmentation fault (11)错误
今天服务器上的apache居然报[notice] child pid 1421 exit signal Segmentation fault (11)错误,为了解决这个问题,网上搜了几个方法都无法解决,而且内存一直都没有释放,最后只好写了个shell来解决问题.
系统:centos 6.2
1.检查服务器
# uname -r
2.6.32-042stab044.11
# cat /etc/redhat-release
CentOS release 6.2 (Final)
# vzctl --version
vzctl version 3.0.30.2
# slabtop
Active / Total Objects (% used) : 239215 / 341771 (70.0%)
Active / Total Slabs (% used) : 14976 / 14979 (100.0%)
Active / Total Caches (% used) : 114 / 234 (48.7%)
Active / Total Size (% used) : 45586.80K / 59450.66K (76.7%)
Minimum / Average / Maximum Object : 0.02K / 0.17K / 4096.00K
OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME
136863 58975 43% 0.10K 3699 37 14796K buffer_head
58968 55520 94% 0.21K 3276 18 13104K dentry
31340 31282 99% 0.19K 1567 20 6268K size-192
20720 20512 98% 0.03K 185 112 740K size-32
14304 14184 99% 0.08K 298 48 1192K sysfs_dir_cache
12331 10395 84% 0.06K 209 59 836K size-64
11310 10996 97% 0.12K 377 30 1508K size-128
next 10 minutes:
Active / Total Objects (% used) : 321424 / 420686 (76.4%)
Active / Total Slabs (% used) : 19739 / 19740 (100.0%)
Active / Total Caches (% used) : 114 / 234 (48.7%)
Active / Total Size (% used) : 64124.31K / 77280.39K (83.0%)
Minimum / Average / Maximum Object : 0.02K / 0.18K / 4096.00K
OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME
136863 60357 44% 0.10K 3699 37 14796K buffer_head
135936 133822 98% 0.21K 7552 18 30208K dentry
31340 31282 99% 0.19K 1567 20 6268K size-192
20720 20509 98% 0.03K 185 112 740K size-32
14304 14184 99% 0.08K 298 48 1192K sysfs_dir_cache
12331 10382 84% 0.06K 209 59 836K size-64
11310 11052 97% 0.12K 377 30 1508K size-128
6468 4865 75% 0.05K 84 77 336K anon_vma_
其实apache报[notice] child pid 1421 exit signal Segmentation fault (11),绝大部分是内存泄露的问题,网上的禁止proxy和cache模块,经过我试验没有效果,而改php内存也一样.
2.解决内存泄露脚本
vi /root/soft/cron_drop_caches.sh
用了上面的脚本,apache再没有报[notice] child pid 1421 exit signal Segmentation fault (11)错误了.
ps:了解linux内存机制可以看这篇文章http://www.linuxatemyram.com/
系统:centos 6.2
1.检查服务器
# uname -r
2.6.32-042stab044.11
# cat /etc/redhat-release
CentOS release 6.2 (Final)
# vzctl --version
vzctl version 3.0.30.2
# slabtop
Active / Total Objects (% used) : 239215 / 341771 (70.0%)
Active / Total Slabs (% used) : 14976 / 14979 (100.0%)
Active / Total Caches (% used) : 114 / 234 (48.7%)
Active / Total Size (% used) : 45586.80K / 59450.66K (76.7%)
Minimum / Average / Maximum Object : 0.02K / 0.17K / 4096.00K
OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME
136863 58975 43% 0.10K 3699 37 14796K buffer_head
58968 55520 94% 0.21K 3276 18 13104K dentry
31340 31282 99% 0.19K 1567 20 6268K size-192
20720 20512 98% 0.03K 185 112 740K size-32
14304 14184 99% 0.08K 298 48 1192K sysfs_dir_cache
12331 10395 84% 0.06K 209 59 836K size-64
11310 10996 97% 0.12K 377 30 1508K size-128
next 10 minutes:
Active / Total Objects (% used) : 321424 / 420686 (76.4%)
Active / Total Slabs (% used) : 19739 / 19740 (100.0%)
Active / Total Caches (% used) : 114 / 234 (48.7%)
Active / Total Size (% used) : 64124.31K / 77280.39K (83.0%)
Minimum / Average / Maximum Object : 0.02K / 0.18K / 4096.00K
OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME
136863 60357 44% 0.10K 3699 37 14796K buffer_head
135936 133822 98% 0.21K 7552 18 30208K dentry
31340 31282 99% 0.19K 1567 20 6268K size-192
20720 20509 98% 0.03K 185 112 740K size-32
14304 14184 99% 0.08K 298 48 1192K sysfs_dir_cache
12331 10382 84% 0.06K 209 59 836K size-64
11310 11052 97% 0.12K 377 30 1508K size-128
6468 4865 75% 0.05K 84 77 336K anon_vma_
其实apache报[notice] child pid 1421 exit signal Segmentation fault (11),绝大部分是内存泄露的问题,网上的禁止proxy和cache模块,经过我试验没有效果,而改php内存也一样.
2.解决内存泄露脚本
vi /root/soft/cron_drop_caches.sh
date; echo "total/used/free/shared/buffers/cached"; echo "before"; free -m|grep Mem:; sync; echo 2 > /proc/sys/vm/drop_caches; echo 0 > /proc/sys/vm/drop_caches; echo "after"; free -m|grep Mem:;
用了上面的脚本,apache再没有报[notice] child pid 1421 exit signal Segmentation fault (11)错误了.
ps:了解linux内存机制可以看这篇文章http://www.linuxatemyram.com/
sync;
echo 2 > /proc/sys/vm/drop_caches;
echo 0 > /proc/sys/vm/drop_caches;
sync把未存盘的cache都写入磁盘
0 – 不释放
1 – 释放页缓存
2 – 释放dentries和inodes
3 – 释放所有缓存
数字1是用来清空最近放问过的文件页面缓存
数字2是用来清空文件节点缓存和目录项缓存
数字3是用来清空1和2所有内容的缓存