Sunday, October 19, 2008

Apache fails!!Semaphores???

Semaphore, it is a lot like a locking mechanism. In any server there is an order of precedence in which tasks must be accomplished. The semaphore is used to maintain that precedence order; more to the point, the precedence order is maintained by the semaphores. A succeeding task may not start until it has received the semaphores from all of it’s predecessors. Likewise child processes of services gets killed or removed before it passes information to its succeeding processes. So it leads them to a hung state because of this incomplete transaction. This will result to failure of these services until we remove the Sem-ids manually from their arrays. Given below is a small script to remove these arrays:-




for semid in `ipcs -s | grep nobody | cut -f2 -d" "`; do ipcrm -s $semid; done