httpd' on server suddenly stop

Hello,

1) Increasing the number of semaphors your system can have will be a good workaround, but might not stop them from growing.

2) Another trick would be to add the semaphor dumping code into an apache restart, so that they're all cleaned up for each restart. To do that, edit:
/etc/init.d/httpd

In that file, you'll find a section that looks like this:
Code:
  restart)
        stop
        waitforexit "httpd" 20
        start
        ;;
Change it to look like this:
Code:
  restart)
        stop
        waitforexit "httpd" 20
        ipcs | grep apache | awk '{print $2}' > /etc/httpd/sem.txt
        for i in `cat /etc/httpd/sem.txt`; do { ipcrm -s $i; }; done;
        start
        ;;

3) The best thing would be to find out what's causing all of the semaphors to show up. This can be hard to do, as you'd have to be able to see into apache's memory stack to really find out what's going on. Using some trial and error methods might work, if we understand why they're created.

Semaphors are used for multiple apache processes to talk between each other and to access shared memory space. They can be many reasons that they would do this, but often times it would be from specific moduels that are installed, or even php scripts. Knowing exactly which one is causing it would be hard to find out, but I would say the first place to check would be anything that might have been added after the install. Eg: if any custom modules were added to apache.. or if there are any "large" php script system that might be using semaphors.. it's possible they're not doing a good job at cleaning up after themselves. Since it's not a common problem on DA boxes, it's less likely to be something that's installed by default (but not impossible)

John
 
Hello,

1) Increasing the number of semaphors your system can have will be a good workaround, but might not stop them from growing.

2) Another trick would be to add the semaphor dumping code into an apache restart, so that they're all cleaned up for each restart. To do that, edit:
/etc/init.d/httpd

In that file, you'll find a section that looks like this:
Code:
  restart)
        stop
        waitforexit "httpd" 20
        start
        ;;

Change it to look like this:

Code:
 restart)
        stop
        waitforexit "httpd" 20
        ipcs | grep apache | awk '{print $2}' > /etc/httpd/sem.txt
        for i in `cat /etc/httpd/sem.txt`; do { ipcrm -s $i; }; done;
        start
        ;;

John

DONE! I HOPE THAT WORK
thank you John
 
Code:
# ipcs -s | awk ' $3 == "apache" {print $2, $3}' | awk '{ print $1}' | while read i; do ipcrm sem $i; done
The above should remove them.

(Don't type the leading # character; it simply means that you need to do this as root.) Create a cronjob to do this hourly if necessary.

Jeff
 
Back
Top