You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Nedelcho Stanev <de...@gmx.co.uk> on 2003/08/15 13:43:26 UTC

apr_shm_create

Hello All,

i have this problem when i use shared memory with Apache.
Apache is 2.0.47, compiled on Red Hat linux 8 with kernel 2.4.18-14.
Same module and same Apache on Windows work perfect, but on linux
i have some problems.
so ...
i create shared memory block with 
sts = apr_shm_create(&client_shm, shmem_size, MOD_MQUBE_SHMEMFILE, ctx);
in initialize_module of my module.
in same function i add cleanup callback with  apr_pool_cleanup_register
in this callbeck i do cleaning with
apr_shm_destroy(client_shm);
client_shm = NULL;

when i stop and start apache properly all works perfect :) but
if server crash, or i kill it with -9 , then in /tmp directory i still have MOD_MQUBE_SHMEMFILE 
file still. and this is ok, because cleanup callback is not called
but when i start again apache apr_shm_create doesent work.
goin in a deep, i see that in sorce of this function ( unix/shm.c)
problem come from here :
if ((new_m->shmid = shmget(shmkey, new_m->realsize,
befor this line we have
status = apr_file_open(&file, filename, 
and this create file correctly
but shmget return error - File exists

so, does anyone know why this happens? :)
btw , same effect is if i don't delete this file from tmp directory
but, even if i delete it apache cannot allocate shared memory.


decho