apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Graham Leggett <minf...@sharp.fm>
Subject Re: apr_shm_attach() and APR_EEXIST
Date Wed, 26 May 2004 13:53:29 GMT
Joe Orton wrote:

> This stuff is a complete mess in APR.  The name-based shmget method
> *does* use and create a real file, but it's redundant AFAICT; all it
> does is store the size of the segment, which shmctl will tell you anyway
> on.
> An uncleanly shutdown httpd (kill -9 or pull the plug) will leave around
> both the shm segment *and* the file, and APR will give EEXIST when
> trying to create either, so you have this fun routine:
> 0. server reboots after power loss
> 1. start httpd: open(O_CREAT) => EEXIST
> 2. admin scratches head, removes file
> 3. start httpd: open(O_CREAT) => ok! shmget(IPC_CREAT) => EEXIST
> 4. admin scratches head, searches bugzilla, learns how to use ipcs/ipcrm
> 5. start httpd: open(O_CREAT) => EXIST
> 6. admin goes crazy
> in the end using anonyous shm everywhere was easier than fixing all the
> FIXMEs in the shm code where it should have had real error handling, so
> I gave up with this stuff.

Ok - what I would like to do is put information on what needs to be done 
in the error message, so that when mod_ldap starts and the shared memory 
goes pear shaped, the admin is given exact instructions on what to do to 
fix it, this removing your step 4 above, and hopefully also step 6. [1]

Something like: "LDAP cache: shared memory segment could not be created 
due to problems with an unclean shutdown. Please run 'ipcrm -m XXXX' to 
fix this."

How would I get the XXXX part? Is this returned anywhere?

(This message would also be platform specific, a suitable message would 
need to be generated for Windows, or for other platforms that don't use 

[1] Remembers being such an admin referred to in step 6.


View raw message