That's exactly what happens and i learnt it the hard way :).

Now my next question is: is there any ideal place provided by the
apache API to allocate a shared memory object?
Is there any source code example of such a use case?

Thanks.
Luca

On Tue, 8 Mar 2005 10:11:57 -0500 (EST), Cliff Woolley
<[EMAIL PROTECTED]> wrote:
> On Tue, 8 Mar 2005, luca regini wrote:
> 
> > My understanding about per server conf is that any structure allocated
> > in the server config handler should have a lifetime that is the same as
> > the one of the module. So the server config structure should be an ideal
> > place for caching values.
> 
> But actually, it's not an ideal place at all, for the very reason you're
> finding here.  I suspect what's happening to your code is that you're
> running up against the fact that each child process has its own copy of
> the server_rec and all of the server_config structures.  They are not in
> shared memory, they're just duplicated when the parent forks itself.
> Therefore these structures are really only meant to be written to by the
> parent at config time.  Writing to them after that point will result in
> inconsistent state across children.
> 
> --Cliff
>

Reply via email to