httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sorin Manolache <>
Subject Re: basic example shared memory code
Date Tue, 22 Nov 2011 22:39:42 GMT
On Tue, Nov 22, 2011 at 21:25, Oğuzhan TOPGÜL <> wrote:
> hey guys,
> i'm in terrible with these shared memory.
> I tried to write a basic module by looking at the examples that basic module
> just holds a counter and prints it to the client.
> when i compile the code attached, i got no error messages. But in apache
> error.log file i got
> lots of
> [notice] child pid 32653 exit signal Segmentation fault (11)
> and my module does not working.
> if you have time to look at my code and send me your advices i'll be
> appreciated. Because i'm getting crazy about these shared memory concepts.
> I just want to define a global variable and process it in each request from
> different sources.
> Regards,
> Oğuzhan TOPGÜL

First remove the exit(1) from child_init. Otherwise apache does not
succeed in creating any children.

If this does not solve your problem, comment all lines dealing with
the mutex and retry. I'm not saying that you don't need mutexes but
commenting them out would at least restrict the area where the
segfaults happen.


> On Tue, Nov 22, 2011 at 9:14 PM, Oğuzhan TOPGÜL <>
> wrote:
>> Thank you guys so much.
>> What i want to do with shared memory is to hold the requester IPs and a
>> counter that holds how many times an IP made request. I'm planning to hold
>> them in a binary tree.
>> I thought holding these IPs and counters in a file is slower than holding
>> them in a shared memory because of the file I/O loss. And using binary tree
>> as a data structure is going to make my search process faster and easier.
>> Do you have any suggestions about shared memory-file usage or data
>> structure usage.
>> Regards
>> Oğuzhan TOPGÜL
>> On Tue, Nov 22, 2011 at 5:15 PM, Nick Kew <> wrote:
>>> On Tue, 22 Nov 2011 09:41:02 -0500
>>> "Pranesh Vadhirajan" <> wrote:
>>> > Nick, can you suggest some of these higher-level abstractions, please?
>>> >  I have been trying to make a module of mine work with a POSIX shared memory
>>> > implementation, but I'm going nowhere with that.  Are you referring to
>>> > apache shared memory implementation (apr_shm_...) or something else?  Either
>>> > way, if you could suggest what I should look into, it would be greatly
>>> > appreciated.
>>> apr_shm is the old way of doing it.
>>> Today I'd recommend looking at mod_slotmem, and the socache modules.
>>> I used the latter for mod_authn_socache, which is a simple example.
>>> --
>>> Nick Kew

View raw message