httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nedelcho Stanev" <>
Subject apr_shm_create
Date Fri, 15 Aug 2003 11:43:26 GMT
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
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.


View raw message