On Wed, 26 May 2004, Graham Leggett wrote:
> Amit Athavale wrote:
>
> > Normally EEXIST is returned when CREATE and EXCL flags are combined.
> > So I guess you are trying to create segment which is already there.
> > check with ipcs
> > whether you have orphan segments ('cause of some reasons)
>
> When I run ipcs, I get a long list of segments under the username used
> for testing Apache, so I guess this would be true.
>
> What is the "correct" way to initialise shared memory in such a way that
> if there was a previous unclean shutdown, it recovers from this condition?
You can't. You need to go in and delete the old memory segments manually.
The real answer though, is that Apache shouldn't have left them lying
around. If it did, that is a bug, and one that we worked very hard to
remove in the Apache code a few years ago.
Ryan
>
> > What are values for these constants in your apr.h (method to use for SHM)
> >
> > APR_USE_SHMEM_MMAP_TMP APR_USE_SHMEM_MMAP_SHM
> > APR_USE_SHMEM_MMAP_ZERO APR_USE_SHMEM_SHMGET_ANON
> > APR_USE_SHMEM_SHMGET APR_USE_SHMEM_MMAP_ANON
>
> It looks like this:
>
> #define APR_USE_SHMEM_MMAP_TMP 0
> #define APR_USE_SHMEM_MMAP_SHM 0
> #define APR_USE_SHMEM_MMAP_ZERO 0
> #define APR_USE_SHMEM_SHMGET_ANON 0
> #define APR_USE_SHMEM_SHMGET 1
> #define APR_USE_SHMEM_MMAP_ANON 1
> #define APR_USE_SHMEM_BEOS 0
>
> Regards,
> Graham
> --
>