apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Orton <jor...@redhat.com>
Subject Re: RFC: graceful handling of abandoned shared memory
Date Wed, 26 Apr 2006 12:19:26 GMT
On Mon, Apr 24, 2006 at 05:04:53PM -0700, Tyler MacDonald wrote:
> This patch makes dealing with SysV IPC shared memory a bit easier:
> 
> 	- If a shared memory segment exists with the key that you want, a
> check is performed to see if anybody else is using it. If not, then it's
> assumed that the segment is a result of an unclean shutdown of a process,
> and we attach to that segment instead of creating our own new one.
> 
> This patch still requires that the file that the named memory segment is
> bound to does not exist, but it *does* ensure that if the file is removed,
> you can usually get your memory segment back and your program won't fail to
> start up because of a poor choice in shared memory implementation. ;-) This
> brings the SysV IPC shmem stuff in APR a lot closer to behaving the same as
> the mmap() implementation. Please let me know what you think.

How does it make the code behave *more* like the mmap implementation?  I 
don't see it.  The named mmap implementation and the shm_open() code 
will both attempt an open with O_EXCL and fail if an existing object 
exists with the given name.

The patch also introduces a new problem: what if a previous process had 
created a shm segment with that key and a different size?  You can't 
carry on regardless in that case.

I don't understand from your previous mail why you can't use 
apr_shm_remove() before creating the shm segment at startup.

joe

Mime
View raw message