random technical thoughts from the Nominet technical team

Apache & Shared Memory

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
Posted by jason on Mar 26th, 2008

We recently had an issue whereby one of our apache servers crashed failing to clean up a shared memory segment. We were using shared memory for SSL session caching:

SSLSessionCache         shm:/var/log/httpd2/gcache(512000)

Which uses a shared memory segment:

-bash-2.05b$ sudo ipcs -a
Password:
IPC status from  as of Tue Mar 25 16:26:29 GMT 2008
T ID KEY MODE OWNER GROUP CREATOR CGROUP CBYTES QNUM QBYTES LSPID LRPID STIME  RTIME CTIME
Message Queues:
T ID KEY MODE OWNER GROUP CREATOR CGROUP NATTCH SEGSZ CPID LPID ATIME DTIME CTIME
Shared Memory:
m 2304 0x13022 --rw------- root other root other 32 512000 17975 9314 9:01:41 9:26:26 9:01:41
T    ID  KEY  MODE OWNER GROUP CREATOR CGROUP NSEMS OTIME  CTIME
Semaphores:
s 65536 0x1cbd       --ra-------     root     root     root     root   129 no-entry 13:47:45
s       1  0x1001cbd  --ra-------     root     root     root     root   128 no-entry 13:47:45

After Apache had crashed when we attempted a startup we received the following errors:

 Tue Mar 25 08:43:48 2008] [error] Cannot allocate shared memory: (17)File exists 

It was a pretty straightforward fix, all we had to do was the following (as root):

ipcrm -m 2304 

This removes the shared memory segment and Apache could be started quite happily once again.

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

Recent Posts

Highest Rated

Categories

Archives

Meta: