No space left on device: Couldn’t create the rewrite-map mutex
갑자기 httpd 죽고, 재시작해도 안 살아 날때.. 에러 로그를 보면 답이 나온다.
0 1 2 3 4 5 6 7 8 9 10 11 |
[root@test /]# httpd -t Syntax OK [root@test /]# service httpd start [root@test /]# ps -ef | grep httpd | wc -l root 27583 21460 0 14:14 pts/10 00:00:00 grep httpd [root@test /]# [root@test /]# tail -f /usr/local/apache/logs/error ..... [core:emerg] [pid 2159] (28)No space left on device: AH00023: Couldn't create the rewrite-map mutex ..... [core:emerg] [pid 11529] (28)No space left on device: AH00023: Couldn't create the rewrite-map mutex ..... [core:emerg] [pid 11897] (28)No space left on device: AH00023: Couldn't create the rewrite-map mutex |
메세지만 보면 디바이스에 공간이 없다는 것인데..
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
[root@er01 free]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 9.8G 580M 8.7G 7% / tmpfs 3.8G 0 3.8G 0% /dev/shm /dev/sda1 190M 64M 116M 36% /boot /dev/sda9 66G 5.5G 57G 9% /free1 /dev/sda8 976M 6.2M 919M 1% /tmp /dev/sda3 9.8G 2.4G 6.9G 26% /usr /dev/sda5 9.8G 1.4G 7.9G 16% /usr/local /dev/sda6 9.8G 1.1G 8.2G 12% /var /dev/sdc1 110G 57G 48G 55% /free # 어딜봐도 용량 딸린 곳은 없다. |
No space left on device: Couldn’t create the rewrite-map mutex
이 메시지는 아파치의 동작 환경에서 각 프로세서 간 데이터 공유 및 동기화를 위해 Semaphore 이라는 것을 생성하는데,
아파치가 정상적으로 종료되지 않고 kill 이나 시스템에 의해 강제로 종요되는 경우 Semaphore 이 삭제되지 않고 남아 있어,
Semaphore 의 개수가 누적이되어 semaphore max value 값까지 생성이 되면 더 이상 Semaphore 을 생성하지 못하기때문에
오류가 발생하며, apache 가 죽어버린다.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
[root@test free]# ipcs -ls ------ Semaphore Limits -------- max number of arrays = 128 max semaphores per array = 250 max semaphores system wide = 32000 max ops per semop call = 32 semaphore max value = 32767 [root@test free]# ipcs -s ------ Semaphore Arrays -------- key semid owner perms nsems 0x00000000 1910046720 root 666 1 0x00000000 1910079489 root 666 1 0x00000000 1910603778 root 666 1 0x00000000 1910636547 root 666 1 0x00000000 1911160836 root 666 1 0x00000000 1911193605 root 666 1 0x00000000 1911717894 root 666 1 0x00000000 1911750663 root 666 1 0x00000000 1911783432 nobody 600 1 0x00000000 1911586825 nobody 600 1 0x00000000 1911619594 nobody 600 1 0x00000000 1911652363 nobody 600 1 0x00000000 1911816204 nobody 600 1 0x00000000 1911848973 nobody 600 1 0x00000000 1911881742 nobody 600 1 ...... |
ipcs -s 명령어를 통해 종료된 semid 를 ipcrm 명령을 통해 종료시켜야 한다.
0 1 2 3 4 5 6 7 8 9 10 |
[root@test free]# vi 1.sh ; ch 1.sh #!/bin/bash ## Semaphore Arrays - pid 검사를 통해 종료된 pid 값을 가진 Semaphore Arrays를 종료 시킨다. for a in `/usr/bin/ipcs -s|awk '$2~/[0-9]/{print $2}'` do sem_pid=`ipcs -si $a|sed '/^$/d'|tail -1|awk '$5~/[0-9]/{print $5}'` if [[ -z `ps -e|awk '$1~/^'$sem_pid'$/{print}'` ]];then /usr/bin/ipcrm -s $a;fi done rm -f $0 |
위 스크립트를 실행했다면..
0 1 2 3 |
# apache 실행 [root@test free]# apachectl start |
아파치를 실행한다.